Skip to content

Commit 93f8928

Browse files
himanshupathak95himanshupathak95t-hamano
authored
Edit Site: Standardize reduced motion handling using media queries (#68419)
Co-authored-by: himanshupathak95 <[email protected]> Co-authored-by: t-hamano <[email protected]>
1 parent 382af64 commit 93f8928

File tree

10 files changed

+47
-24
lines changed

10 files changed

+47
-24
lines changed

packages/edit-site/src/components/canvas-loader/style.scss

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
align-items: center;
1010
justify-content: center;
1111

12-
animation: 0.5s ease 0.2s edit-site-canvas-loader__fade-in-animation;
13-
animation-fill-mode: forwards;
14-
@include reduce-motion("animation");
12+
@media not (prefers-reduced-motion) {
13+
animation: 0.5s ease 0.2s edit-site-canvas-loader__fade-in-animation;
14+
animation-fill-mode: forwards;
15+
}
1516

1617
& > div {
1718
width: 160px;

packages/edit-site/src/components/editor-canvas-container/style.scss

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
position: absolute;
2727
right: 0;
2828
top: 0;
29-
transition: all 0.3s; // Match .block-editor-iframe__body transition.
29+
@media not (prefers-reduced-motion) {
30+
transition: all 0.3s; // Match .block-editor-iframe__body transition.
31+
}
3032
}
3133

3234
.edit-site-editor-canvas-container__close-button {

packages/edit-site/src/components/editor/style.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
.edit-site-editor__editor-interface {
22
opacity: 1;
3-
transition: opacity 0.1s ease-out;
4-
@include reduce-motion( "transition" );
3+
4+
@media not (prefers-reduced-motion) {
5+
transition: opacity 0.1s ease-out;
6+
}
57

68
&.is-loading {
79
opacity: 0;

packages/edit-site/src/components/global-styles/font-library-modal/style.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,10 @@ $footer-height: 70px;
129129
.font-library-modal__font-variant_demo-text {
130130
white-space: nowrap;
131131
flex-shrink: 0;
132-
transition: opacity 0.3s ease-in-out;
133-
@include reduce-motion( "transition" );
132+
133+
@media not (prefers-reduced-motion) {
134+
transition: opacity 0.3s ease-in-out;
135+
}
134136
}
135137
}
136138

packages/edit-site/src/components/global-styles/variations/style.scss

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99
outline-offset: -$border-width;
1010
overflow: hidden;
1111
position: relative;
12-
// Add the same transition that block style variations and other buttons have.
13-
transition: outline 0.1s linear;
14-
@include reduce-motion("transition");
12+
@media not (prefers-reduced-motion) {
13+
// Add the same transition that block style variations and other buttons have.
14+
transition: outline 0.1s linear;
15+
}
1516

1617
&.is-pill {
1718
height: $button-size-compact;

packages/edit-site/src/components/layout/style.scss

+8-3
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,13 @@
115115

116116
.edit-site-resizable-frame__inner-content {
117117
box-shadow: $elevation-x-small;
118-
transition: border-radius, box-shadow 0.4s;
119118
// This ensure the radius work properly.
120119
overflow: hidden;
121120

121+
@media not (prefers-reduced-motion) {
122+
transition: border-radius, box-shadow 0.4s;
123+
}
124+
122125
.edit-site-layout:not(.is-full-canvas) & {
123126
border-radius: $radius-large;
124127
}
@@ -195,8 +198,6 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
195198
}
196199

197200
&::before {
198-
transition: box-shadow 0.1s ease;
199-
@include reduce-motion("transition");
200201
content: "";
201202
display: block;
202203
position: absolute;
@@ -206,6 +207,10 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
206207
left: 9px;
207208
border-radius: $radius-medium;
208209
box-shadow: none;
210+
211+
@media not (prefers-reduced-motion) {
212+
transition: box-shadow 0.1s ease;
213+
}
209214
}
210215

211216
.edit-site-layout__view-mode-toggle-icon {

packages/edit-site/src/components/page-patterns/style.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626
top: 0;
2727
z-index: 2;
2828
flex-shrink: 0;
29-
transition: padding ease-out 0.1s;
30-
@include reduce-motion("transition");
3129
min-height: $grid-unit-50;
3230

31+
@media not (prefers-reduced-motion) {
32+
transition: padding ease-out 0.1s;
33+
}
34+
3335
.edit-site-patterns__title {
3436
min-height: $grid-unit-50;
3537

packages/edit-site/src/components/page-templates/style.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@
6767
height: $grid-unit-20;
6868
object-fit: cover;
6969
opacity: 0;
70-
transition: opacity 0.1s linear;
71-
@include reduce-motion("transition");
7270
border-radius: 100%;
71+
72+
@media not (prefers-reduced-motion) {
73+
transition: opacity 0.1s linear;
74+
}
7375
}
7476

7577
&.is-loaded {

packages/edit-site/src/components/page/style.scss

+8-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
height: calc(100% - #{$header-height});
55
/* stylelint-disable-next-line property-no-unknown -- '@container' not globally permitted */
66
container: edit-site-page / inline-size;
7-
transition: width ease-out 0.2s;
8-
@include reduce-motion("transition");
7+
8+
@media not (prefers-reduced-motion) {
9+
transition: width ease-out 0.2s;
10+
}
911

1012
@include break-medium() {
1113
height: 100%;
@@ -19,8 +21,10 @@
1921
position: sticky;
2022
top: 0;
2123
z-index: z-index(".edit-site-page-header");
22-
transition: padding ease-out 0.1s;
23-
@include reduce-motion("transition");
24+
25+
@media not (prefers-reduced-motion) {
26+
transition: padding ease-out 0.1s;
27+
}
2428

2529
.components-heading {
2630
color: $gray-900;

packages/edit-site/src/components/site-hub/style.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@
6565
opacity: 0;
6666
position: absolute;
6767
right: 0;
68-
transition: opacity 0.1s linear;
69-
@include reduce-motion("transition");
68+
69+
@media not (prefers-reduced-motion) {
70+
transition: opacity 0.1s linear;
71+
}
7072
}
7173

7274
&:hover::after,

0 commit comments

Comments
 (0)