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

fix(nuxt): disable View Transitions when prefers-reduced-motion: reduce #22292

Merged
merged 3 commits into from Jan 18, 2024

Conversation

lukewarlow
Copy link
Contributor

πŸ”— Linked issue

#22291

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

View transitions now early return when the prefers-reduced-motion user preference is reduce. This improves the out of the box accessibility of the feature.

Resolves #22291

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@stackblitz
Copy link

stackblitz bot commented Jul 23, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@danielroe danielroe requested a review from antfu July 24, 2023 08:24
@danielroe danielroe changed the title Disable View Transitions when prefers-reduced-motion is reduce fix: disable View Transitions when prefers-reduced-motion: reduce Jul 24, 2023
@danielroe danielroe changed the title fix: disable View Transitions when prefers-reduced-motion: reduce fix(nuxt): disable View Transitions when prefers-reduced-motion: reduce Jul 24, 2023
@DamianGlowala
Copy link
Member

DamianGlowala commented Jul 24, 2023

This might help:

https://developer.chrome.com/docs/web-platform/view-transitions/#reacting-to-the-reduced-motion-preference

However, a preference for 'reduced motion' doesn't mean the user wants no motion. Instead of the above, you could choose a more subtle animation, but one that still expresses the relationship between elements, and the flow of data.

@lukewarlow
Copy link
Contributor Author

This might help:

https://developer.chrome.com/docs/web-platform/view-transitions/#reacting-to-the-reduced-motion-preference

However, a preference for 'reduced motion' doesn't mean the user wants no motion. Instead of the above, you could choose a more subtle animation, but one that still expresses the relationship between elements, and the flow of data.

Ah thanks god knows how I missed that when I read through that post. I was missing the -group pseudo. That appears to be working now.

I still feel it's valuable to have an option to skip the transition (it skips the steps of generating the old and new images of DOM) but I get if you would rather this not be the default. I'm not familar with the plugin API does nuxtApp expose an options object?

@lukewarlow
Copy link
Contributor Author

lukewarlow commented Jul 24, 2023

withastro/astro#7757 fwiw astro appear to have gone the route of disabling view transitions by default (they used CSS instead)

Thanks @rschristian for pointing me to this

@lukewarlow lukewarlow marked this pull request as ready for review January 13, 2024 16:45
@lukewarlow
Copy link
Contributor Author

Apologies it's taken so long to get back to this. Hopefully the latest commit is correct

@danielroe danielroe requested a review from manniL January 14, 2024 12:28
@danielroe danielroe added this to the 3.10 milestone Jan 15, 2024
@lukewarlow
Copy link
Contributor Author

Just double checking is this waiting on me for anything? No worries if it just needs time or other reviews, wanna make sure i'm not the blocker though.

@danielroe
Copy link
Member

Nope! It's good to go, and I plan to merge it in time for the next minor release.

@danielroe danielroe merged commit e44e8b3 into nuxt:main Jan 18, 2024
34 checks passed
@github-actions github-actions bot mentioned this pull request Jan 18, 2024
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.

Disable View Transitions when prefers-reduced-motion is reduce
4 participants