Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
fix: disable touch actions when pointer-events are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
cecilia-sanare committed Aug 30, 2021
1 parent cf60483 commit 84f4e5e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion stories/Dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}

&:not(.visible) .list {
pointer-events: none;
@include interaction(false);
}

&.visible .list {
Expand Down
7 changes: 4 additions & 3 deletions stories/Favorite.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
}

> * {
pointer-events: none;
@include interaction(false);
}

.pseudoHover {
@include absolute();
@include transition(color);
@include interaction(false);

pointer-events: none;
color: transparent;
}

Expand All @@ -33,11 +33,12 @@
}

.fanfare {
@include interaction(false);

position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%) scale(0.8);
pointer-events: none;

width: 100px;
height: 100px;
Expand Down
5 changes: 3 additions & 2 deletions stories/Modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
.modalContainer {
@include fixed();
@include transition(background-color);
@include interaction(false);

z-index: 9999;
display: flex;
align-items: flex-start;
justify-content: center;
font-family: $font-family;
pointer-events: none;
background-color: transparent;

> .modal {
Expand All @@ -33,7 +33,8 @@
}

&.opened {
pointer-events: all;
@include interaction(true);

background-color: $backdrop;
}

Expand Down
2 changes: 1 addition & 1 deletion stories/Spinner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

.spinner {
@include loading(true);
@include interaction(false);

&.fit {
@include absolute();
Expand All @@ -18,7 +19,6 @@
display: inline-flex;
align-items: center;
justify-content: center;
pointer-events: none;

&:after {
content: '';
Expand Down
2 changes: 1 addition & 1 deletion stories/Tooltip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

.tooltip {
@include transition(opacity);
@include interaction(false);

display: inline-flex;
align-items: center;
position: absolute;
top: 50%;
transform: translate(0, -50%);
pointer-events: none;
white-space: nowrap;
padding: 0 $padding;
height: $min-component-size;
Expand Down
15 changes: 13 additions & 2 deletions stories/_mixins.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
@use './variables' as *;

@mixin interaction($enabled) {
@if $enabled {
pointer-events: all;
touch-action: auto;
} @else {
pointer-events: none;
touch-action: none;
}
}

@function fallback($values...) {
@each $value in $values {
@if $value != null {
Expand Down Expand Up @@ -35,9 +45,9 @@
&::before {
@include absolute(0);
@include transition(opacity);
@include interaction(false);

border-radius: inherit;
pointer-events: none;
content: '';
background-color: $hover;
opacity: 0;
Expand All @@ -50,9 +60,10 @@
}

@mixin disabled() {
@include interaction(false);

color: $primary-accent;
background-color: $disabled;
pointer-events: none;
}

@mixin transition($properties...) {
Expand Down

0 comments on commit 84f4e5e

Please sign in to comment.