Skip to content

Commit 8b837f7

Browse files
Mayank-Tripathi32Mayank-Tripathi32t-hamano
authored
[Block Editor]: A11y - Add and Update missing reduce-motion mixing (#68417)
Co-authored-by: Mayank-Tripathi32 <mayanktripathi32@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org>
1 parent 4f5270a commit 8b837f7

File tree

19 files changed

+131
-78
lines changed

19 files changed

+131
-78
lines changed

packages/block-editor/src/components/block-canvas/style.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ iframe[name="editor-canvas"] {
44
height: 100%;
55
display: block;
66
// Handles transitions between device previews
7-
transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96);
8-
@include reduce-motion("transition");
7+
@media not ( prefers-reduced-motion ) {
8+
transition: all 400ms cubic-bezier(0.46, 0.03, 0.52, 0.96);
9+
}
910
background-color: $gray-300;
1011
}

packages/block-editor/src/components/block-draggable/style.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@
5959
justify-content: center;
6060
align-items: center;
6161
background-color: transparent;
62-
transition: all 0.1s linear 0.1s;
62+
@media not ( prefers-reduced-motion ) {
63+
transition: all 0.1s linear 0.1s;
64+
}
6365

6466
.block-editor-block-draggable-chip__disabled-icon {
6567
width: $grid-unit-50 * 0.5;

packages/block-editor/src/components/block-list/content.scss

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,12 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
5858
background: var(--wp-admin-theme-color);
5959
opacity: 0.4;
6060

61-
// Animate.
62-
animation: selection-overlay__fade-in-animation 0.1s ease-out;
63-
animation-fill-mode: forwards;
64-
@include reduce-motion("animation");
61+
@media not ( prefers-reduced-motion ) {
62+
63+
// Animate.
64+
animation: selection-overlay__fade-in-animation 0.1s ease-out;
65+
animation-fill-mode: forwards;
66+
}
6567

6668
// Show outline in high contrast mode.
6769
outline: 2px solid transparent;
@@ -271,8 +273,9 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
271273
// Spotlight mode. Fade out blocks unless they contain a selected block.
272274
.is-focus-mode .block-editor-block-list__block:not(.has-child-selected) {
273275
opacity: 0.2;
274-
transition: opacity 0.1s linear;
275-
@include reduce-motion("transition");
276+
@media not ( prefers-reduced-motion ) {
277+
transition: opacity 0.1s linear;
278+
}
276279

277280
// Nested blocks should never be faded. If the parent block is already faded
278281
// out, it shouldn't be faded out more. If the parent block in not faded
@@ -339,9 +342,10 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
339342
// Hide the appender that sits at the end of block lists, when inside a nested block,
340343
// unless the block itself, or a parent, is selected.
341344
.wp-block .block-list-appender .block-editor-inserter__toggle {
342-
animation: block-editor-inserter__toggle__fade-in-animation 0.1s ease;
343-
animation-fill-mode: forwards;
344-
@include reduce-motion("animation");
345+
@media not ( prefers-reduced-motion ) {
346+
animation: block-editor-inserter__toggle__fade-in-animation 0.1s ease;
347+
animation-fill-mode: forwards;
348+
}
345349
}
346350

347351
.block-editor-block-list__block:not(.is-selected):not(.has-child-selected) .block-editor-default-block-appender {
@@ -367,8 +371,9 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
367371
font-family: $editor-html-font;
368372
font-size: $text-editor-font-size;
369373
line-height: 1.5;
370-
transition: padding 0.2s linear;
371-
@include reduce-motion("transition");
374+
@media not ( prefers-reduced-motion ) {
375+
transition: padding 0.2s linear;
376+
}
372377

373378
&:focus {
374379
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
@@ -400,7 +405,9 @@ _::-webkit-full-page-media, _:future, :root [data-has-multi-selection="true"] .b
400405
// Additional -1px is required to avoid sub pixel rounding errors allowing background to show.
401406
margin-left: -1px;
402407
margin-right: -1px;
403-
transition: background-color 0.3s ease;
408+
@media not ( prefers-reduced-motion ) {
409+
transition: background-color 0.3s ease;
410+
}
404411
display: flex;
405412
align-items: center;
406413
justify-content: center;

packages/block-editor/src/components/block-mover/style.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@
8787
right: $grid-unit-10;
8888
z-index: -1;
8989

90-
// Animate in.
91-
animation: components-button__appear-animation 0.1s ease;
92-
animation-fill-mode: forwards;
93-
@include reduce-motion("animation");
90+
@media not ( prefers-reduced-motion ) {
91+
// Animate in.
92+
animation: components-button__appear-animation 0.1s ease;
93+
animation-fill-mode: forwards;
94+
}
9495
}
9596

9697
// Don't show the focus inherited by the Button component.

packages/block-editor/src/components/block-pattern-setup/style.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@
130130
background-color: $white;
131131
margin: auto;
132132
padding: 0;
133-
transition: transform 0.5s, z-index 0.5s;
133+
@media not ( prefers-reduced-motion ) {
134+
transition: transform 0.5s, z-index 0.5s;
135+
}
134136
z-index: z-index(".block-editor-block-pattern-setup .pattern-slide");
135137

136138
&.active-slide {

packages/block-editor/src/components/block-patterns-list/style.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
outline: $border-width solid rgba($black, 0.1);
4545
outline-offset: -$border-width;
4646
border-radius: $radius-medium;
47-
48-
transition: outline 0.1s linear;
49-
@include reduce-motion("transition");
47+
@media not ( prefers-reduced-motion ) {
48+
transition: outline 0.1s linear;
49+
}
5050
}
5151
}
5252

packages/block-editor/src/components/block-switcher/style.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@
129129
.block-editor-block-switcher__preview-patterns-container-list__item {
130130
height: 100%;
131131
border-radius: $radius-small;
132-
transition: all 0.05s ease-in-out;
132+
@media not ( prefers-reduced-motion ) {
133+
transition: all 0.05s ease-in-out;
134+
}
133135
position: relative;
134136
border: $border-width solid transparent;
135137

packages/block-editor/src/components/block-toolbar/style.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
overflow-y: hidden;
1313
overflow-x: auto;
1414

15-
// Animation
16-
transition: border-color 0.1s linear, box-shadow 0.1s linear;
17-
@include reduce-motion("transition");
15+
@media not ( prefers-reduced-motion ) {
16+
17+
// Animation
18+
transition: border-color 0.1s linear, box-shadow 0.1s linear;
19+
}
1820

1921
@include break-small() {
2022
overflow: inherit;

packages/block-editor/src/components/block-tools/style.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,12 @@
191191

192192
.is-dragging-components-draggable & {
193193
opacity: 0;
194-
// Use a minimal duration to delay hiding the element, see hide-during-dragging animation for more details.
195-
// It's essential to hide the toolbar/popover so that `dragEnter` events can pass through them to the underlying elements.
196-
animation: hide-during-dragging 1ms linear forwards;
194+
@media not ( prefers-reduced-motion ) {
195+
196+
// Use a minimal duration to delay hiding the element, see hide-during-dragging animation for more details.
197+
// It's essential to hide the toolbar/popover so that `dragEnter` events can pass through them to the underlying elements.
198+
animation: hide-during-dragging 1ms linear forwards;
199+
}
197200
}
198201

199202
.block-editor-block-parent-selector {

packages/block-editor/src/components/button-block-appender/content.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,8 @@
7979
background-color: var(--wp-admin-theme-color);
8080
box-shadow: inset 0 0 0 $border-width $light-gray-placeholder;
8181
color: $light-gray-placeholder;
82-
transition: background-color 0.2s ease-in-out;
83-
84-
@media ( prefers-reduced-motion: reduce ) {
85-
transition: none;
82+
@media not ( prefers-reduced-motion ) {
83+
transition: background-color 0.2s ease-in-out;
8684
}
8785
}
8886
}

0 commit comments

Comments
 (0)