Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a11y: Add missing reduce-motion mixin #68284

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
border: 0;
text-align: left;
transition: box-shadow 0.1s linear;
@include reduce-motion("transition");

// The item contains absolutely positioned items.
// Set `position: relative` on the parent to prevent overflow issues
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
align-items: center;
background-color: transparent;
transition: all 0.1s linear 0.1s;
@include reduce-motion("transition");

.block-editor-block-draggable-chip__disabled-icon {
width: $grid-unit-50 * 0.5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
margin-left: -1px;
margin-right: -1px;
transition: background-color 0.3s ease;
@include reduce-motion("transition");
display: flex;
align-items: center;
justify-content: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
margin: auto;
padding: 0;
transition: transform 0.5s, z-index 0.5s;
@include reduce-motion("transition");
z-index: z-index(".block-editor-block-pattern-setup .pattern-slide");

&.active-slide {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
height: 100%;
border-radius: $radius-small;
transition: all 0.05s ease-in-out;
@include reduce-motion("transition");
position: relative;
border: $border-width solid transparent;

Expand Down
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 @@ -80,6 +80,7 @@
box-shadow: inset 0 0 0 $border-width $light-gray-placeholder;
color: $light-gray-placeholder;
transition: background-color 0.2s ease-in-out;
@include reduce-motion("transition");

@media ( prefers-reduced-motion: reduce ) {
transition: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
transform: scale(1);
transition: transform 0.1s ease;
will-change: transform;
@include reduce-motion("transition");

&:focus {
border: #{ $border-width * 2 } solid $gray-700;
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/components/iframe/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
transform-origin: top center;
// Prevents a flash of background color change when entering/exiting zoom out
transition: background-color 400ms;
@include reduce-motion("transition");

&.zoom-out-animation {
$scroll-top: var(--wp-block-editor-iframe-zoom-out-scroll-top, 0);
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
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@
margin: 0;
text-decoration: none;
transition: box-shadow 0.1s linear;
@include reduce-motion("transition");

.components-modal__content & {
padding-left: 0;
Expand Down
8 changes: 8 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 @@ -168,6 +169,7 @@
padding: 0;
border-radius: 4px;
transition: opacity 0.2s ease;
@include reduce-motion("transition");

&:focus-visible {
outline: 3px auto rgb(90 90 90 / 25%);
Expand Down Expand Up @@ -281,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 @@ -302,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/block-library/src/navigation/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ $navigation-icon-size: 24px;
opacity: 0;
transition: opacity 0.1s linear;
visibility: hidden;
@include reduce-motion("transition");

// Don't take up space when the menu is collapsed.
width: 0;
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/components/src/drop-zone/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
opacity: 1;

transition: opacity 0.2s ease-in-out;
@include reduce-motion("transition");
@media (prefers-reduced-motion) {
transition: none;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
right: 0;
top: 0;
transition: all 0.3s; // Match .block-editor-iframe__body transition.
@include reduce-motion("transition");
}

.edit-site-editor-canvas-container__close-button {
Expand Down
1 change: 1 addition & 0 deletions packages/edit-site/src/components/layout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
.edit-site-resizable-frame__inner-content {
box-shadow: $elevation-x-small;
transition: border-radius, box-shadow 0.4s;
@include reduce-motion("transition");
// This ensure the radius work properly.
overflow: hidden;

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
Loading