-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Prevent animations with prefers-reduced-motion #7757
Conversation
🦋 Changeset detectedLatest commit: 07455eb The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
The problem with this is that the fallback animations will still occur because those pseudo-elements don't exist in Firefox, etc.
This is why my solution used JavaScript in #7755 instead of Jake Archibald's suggestion-- however this will still be necessary to skip animations with the unstable meta tag version of View Transitions because that is not reliant on JavaScript.
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.
Good point. We have a data attribute for the fallback. Does this cover it then? cda8dbf
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.
I think this one is ok. The fallback will do the setTimeout wait since there are no animations, but that's ok. And I think it's still ok to call startViewTransition
even if you are not doing animations.
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.
[data-astro-transition-fallback] isn't working for me. The animations are still firing on Firefox, but [data-astro-transition-scope] seems to work fine as a selector. Would it ever not be placed on an animation?
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.
Oh, I think it actually needs to be:
[data-astro-transition-fallback=new] [data-astro-transition-scope] {
animation: none !important;
}
The animations are on the actual elements in the fallback. So yeah, it can be simplified to just use [data-astro-transition-scope]
. I'll update the PR.
Changes
prefers-reduced-motion
that eliminates the animations.Testing
N/A
Docs
N/A