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

Respect reduced-motion in the customizer #1608

Closed

Conversation

kevin940726
Copy link
Member

Respect prefers-reduced-motion: reduce in the customizer.

Kapture.2021-08-20.at.14.54.35.mp4

Test steps:

  1. Enable reduce motion in your OS settings (macOS for instance)
  2. Visit Appearance -> Customize
  3. Click around different sections and panels
  4. There should be no transition nor animation effects
  5. Focus should not lost when expanding sections
  6. Everything should work fine when disabling reduce motion too

Trac ticket: https://core.trac.wordpress.org/ticket/53542


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is working well as long as we reload the page after changing system settings 😅

I'm not sure how much of an issue it is, but if we load the Customizer with "Reduce motion" enabled and then disable it, but don't reload the Customizer, interacting with the sections makes them go partially off-screen:

Screen Shot 2021-08-23 at 11 31 59 am

When doing it the other way around (starting with "Reduce motion" off and then enabling it), everything looks fine but it's impossible to tab into each section with the keyboard.

// Return if CSS transitions are not supported or if reduced motion is enabled.
if ( ! normalizedTransitionendEventName || isReducedMotion ) {
// Schedule the callback until the next tick to prevent focus loss.
_.defer( function () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where was the focus loss occurring?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should focus the "Back" button when expanding to a section. That is lost if we call the callback synchronously though.

@kevin940726
Copy link
Member Author

@tellthemachines Good catch! I don't think it's too much of an issue but I pushed a fix anyway :).

@hellofromtonya
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants