-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Edit Site: Standardize reduced motion handling using media queries #68419
Edit Site: Standardize reduced motion handling using media queries #68419
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Hey @t-hamano, Please review these changes whenever you get a moment and let me know if the changes are as expected. Thanks 😇 |
packages/edit-site/src/components/global-styles/font-library-modal/style.scss
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! It's working correctly in every component.
Thank you @gziolo I debugged and found that the issue arises from this place. All other file changes are not causing any issues, but this one is. The preprocessor is converting the SCSS to the following, as shown in the screenshot above. It was incorrectly compiling the not and the &. Codegutenberg/packages/edit-site/src/components/layout/style.scss Lines 111 to 133 in 5b06788
The previous compiled code with wrong parenthisis [1] 2575 │ @media (min-width: 782px) and (not (prefers-reduced-motion)) { Changing the code to the following solves the issue: Reference @media (prefers-reduced-motion: no-preference) {
transition: border-radius, box-shadow 0.4s;
} New compiled code: @media (min-width: 782px) and (prefers-reduced-motion: no-preference) {
.edit-site-layout__canvas .edit-site-resizable-frame__inner-content {
transition: border-radius, box-shadow 0.4s;
}
} |
@im3dabasia Thanks for looking into it! I think we can go with that hotfix for now. Though, we'll want some additional measures to prevent this from happening again:
cc @WordPress/gutenberg-components for awareness. |
Thank you for solving the problem with Storybook CI. I was looking into what the cause of this problem was. In Storybook, we import the CSS file built here. I'm not sure, but I'm guessing it might be because the CSS files are imported as SCSS files. For example, I noticed that I could build the Storybook successfully by making the following changes: DetailsRevert #68464 and explicitly import the built file as a CSS file: diff --git a/packages/edit-site/src/components/layout/style.scss b/packages/edit-site/src/components/layout/style.scss
index 8d44015d529..caf7dd78da4 100644
--- a/packages/edit-site/src/components/layout/style.scss
+++ b/packages/edit-site/src/components/layout/style.scss
@@ -118,7 +118,7 @@
// This ensure the radius work properly.
overflow: hidden;
- @media (prefers-reduced-motion: no-preference) {
+ @media not (prefers-reduced-motion) {
transition: border-radius, box-shadow 0.4s;
}
diff --git a/storybook/package-styles/edit-site-ltr.lazy.scss b/storybook/package-styles/edit-site-ltr.lazy.scss
index c704fe9d953..c650798e554 100644
--- a/storybook/package-styles/edit-site-ltr.lazy.scss
+++ b/storybook/package-styles/edit-site-ltr.lazy.scss
@@ -1 +1 @@
-@import "../../packages/edit-site/build-style/style";
+@import "../../packages/edit-site/build-style/style.css";
diff --git a/storybook/package-styles/edit-site-rtl.lazy.scss b/storybook/package-styles/edit-site-rtl.lazy.scss
index ae9ac27d6b5..a1f44ec2f7c 100644
--- a/storybook/package-styles/edit-site-rtl.lazy.scss
+++ b/storybook/package-styles/edit-site-rtl.lazy.scss
@@ -1 +1 @@
-@import "../../packages/edit-site/build-style/style-rtl";
+@import "../../packages/edit-site/build-style/style-rtl.css"; Try to build Storybook:
Maybe we need to explicitly specify the extension in the Sass: Breaking Change: Media Queries Level 4: https://sass-lang.com/documentation/breaking-changes/media-logic/ |
That makes sense! Might be a good fix. |
…ordPress#68419) Co-authored-by: himanshupathak95 <abcd95@git.wordpress.org> Co-authored-by: t-hamano <wildworks@git.wordpress.org>
Part of: #68282
What?
Replace the reduce-motion mixin with
@media not (prefers-reduced-motion)
media queries across all components in the edit-site package. This standardizes how we handle reduced motion preferences throughout the codebase.Testing Instructions
Enable the Site Editor
Test each component that has animations:
Verify animations work normally
In your system preferences, enable reduced motion:
Verify that animations are disabled when reduced motion is enabled
Screencast
Screen.Recording.2025-01-02.at.07.57.14.mov
Screen.Recording.2025-01-02.at.08.16.30.mov