Skip to content

Commit

Permalink
a11y: Add missing reduce-motion mixin for animations
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshupathak95 committed Dec 25, 2024
1 parent 42463cf commit eeddf38
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@
// Use a minimal duration to delay hiding the element, see hide-during-dragging animation for more details.
// It's essential to hide the toolbar/popover so that `dragEnter` events can pass through them to the underlying elements.
animation: hide-during-dragging 1ms linear forwards;
@include reduce-motion("animation");
}

.block-editor-block-parent-selector {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ $block-editor-link-control-number-of-actions: 1;
border-radius: 100%;
animation: loadingpulse 1s linear infinite;
animation-delay: 0.5s; // avoid animating for fast network responses
@include reduce-motion("animation");
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions packages/block-library/src/image/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

&.show {
animation: show-content-image 0.4s;
@include reduce-motion("animation");
}
}
}
Expand Down Expand Up @@ -282,13 +283,15 @@
&.active {
visibility: visible;
animation: both turn-on-visibility 0.25s;
@include reduce-motion("animation");
img {
animation: both turn-on-visibility 0.35s;
}
}
&.show-closing-animation {
&:not(.active) {
animation: both turn-off-visibility 0.35s;
@include reduce-motion("animation");
img {
animation: both turn-off-visibility 0.25s;
}
Expand All @@ -303,27 +306,31 @@
animation: none;
.lightbox-image-container {
animation: lightbox-zoom-in 0.4s;
@include reduce-motion("animation");
// Override fade animation for image
img {
animation: none;
}
}
.scrim {
animation: turn-on-visibility 0.4s forwards;
@include reduce-motion("animation");
}
}
&.show-closing-animation {
&:not(.active) {
animation: none;
.lightbox-image-container {
animation: lightbox-zoom-out 0.4s;
@include reduce-motion("animation");
// Override fade animation for image
img {
animation: none;
}
}
.scrim {
animation: turn-off-visibility 0.4s forwards;
@include reduce-motion("animation");
}
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/animate/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

.components-animate__loading {
animation: components-animate__loading 1.6s ease-in-out infinite;
@include reduce-motion("animation");
}

@keyframes components-animate__loading {
Expand Down
6 changes: 1 addition & 5 deletions packages/components/src/button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,7 @@
&.is-secondary.is-busy:disabled,
&.is-secondary.is-busy[aria-disabled="true"] {
animation: components-button__busy-animation 2500ms infinite linear;
// This should be refactored to use the reduce-motion("animation") mixin
// as soon as https://github.com/WordPress/gutenberg/issues/55566 is closed.
@media (prefers-reduced-motion: reduce) {
animation-duration: 0s;
}
@include reduce-motion("animation");
background-size: 100px 100%;
/* stylelint-disable -- Disable reason: This function call looks nicer when each argument is on its own line. */
background-image: linear-gradient(
Expand Down
1 change: 1 addition & 0 deletions packages/nux/src/components/dot-tip/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ $dot-scale: 3; // How much the pulse animation should scale up by in size

&::before {
animation: nux-pulse 1.6s infinite cubic-bezier(0.17, 0.67, 0.92, 0.62);
@include reduce-motion("animation");
background: rgba(#00739c, 0.9);
opacity: 0.9;
height: $dot-size * $dot-scale;
Expand Down

0 comments on commit eeddf38

Please sign in to comment.