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

Respects prefers-reduced-motion for content animations. #26286

Merged
merged 1 commit into from
Jan 10, 2020

Conversation

gmajoulet
Copy link
Contributor

Respects prefers-reduced-motion for AMP story content animations.
This does not affect system components for now, but only animations provided by animate-in attributes, or custom publisher animations.

#24821

@jackbsteinberg
Copy link
Contributor

jackbsteinberg commented Jan 9, 2020

Thanks for the fix, glad we're supporting this a11y option!

Just as a note this also won't yet affect story specific amp components with default animations (specifically <amp-story-quiz>).

@gmajoulet
Copy link
Contributor Author

Yep, we'll have to send a second PR to disable animations on all these components (quiz, sidebar, ...).

@@ -40,6 +40,15 @@ amp-consent {
z-index: initial !important;
}

@media (prefers-reduced-motion: reduce) {
*,
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this going to be a super expensive selector?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not entirely sure, I'm never really worried about CSS selectors usually, only about their properties.
I got most of the information here: https://developers.google.com/web/updates/2019/03/prefers-reduced-motion#bonus_forcing_reduced_motion_on_all_websites

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(There's no obvious difference in the metrics the devtools give, but I didn't check the evaluation time)

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good, but worth keeping in mind in case we notice a difference between regular and reduced motion. I was primarily worried because stories often have long and deep DOM trees

Copy link
Contributor

@Enriqe Enriqe left a comment

Choose a reason for hiding this comment

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

Cool feature :)

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

Successfully merging this pull request may close these issues.

None yet

6 participants