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

Warn when view transitions run on a prefer-reduced-motion device #10222

Merged
merged 2 commits into from
Feb 26, 2024

Conversation

martrapp
Copy link
Member

@martrapp martrapp commented Feb 23, 2024

Changes

In DEV mode, warn in the browser console when view transitions are used on a prefer-reduced-motion device.

A user at discord complained that view transitions wouldn't work at all, and @FredKSchott suggested that this could be the reason. Always fun to use an argument from authority!

Question: I would even like to remove the restriction that the warning is only shown in DEV mode as it is really hard to find. What do the approvers think?
Edit: (The warning is only shown with initial page loads, not on every view transition)

Testing

Manually tested on Windows with Chrome

Docs

Basically the warning message copies https://docs.astro.build/en/guides/view-transitions/#prefers-reduced-motion. So docs is more than up-to-date.

Copy link

changeset-bot bot commented Feb 23, 2024

🦋 Changeset detected

Latest commit: 0e8e09b

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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Feb 23, 2024
@martrapp martrapp changed the title Warn when view transitions run on a prefere-reduced-motion device Warn when view transitions run on a prefer-reduced-motion device Feb 23, 2024
@OliverSpeir
Copy link
Contributor

Hmm ignoring in dev might be nice, but I assume there’s at least one dev who actually does want to prefer reduce motion for their own sake.

Could it be a config option ?

@martrapp
Copy link
Member Author

Hmm ignoring in dev might be nice

Ah @OliverSpeir , I'm afraid, I didn't make myself clear: If someone has set up prefer-reduced-motion, we should definitely respect that. But I suspect that many developers only come across users who have set up their system this way in PROD. I therefore believe that the new warning message could also be useful in PROD.

@martrapp
Copy link
Member Author

Might need a different text then: "This page was created with view transitions. Because your device ...." or similar. I'm usually the worst candidate to get English text right :)

@matthewp
Copy link
Contributor

A lot of people will dislike logging happening in their frontend application. I think in dev mode it is ok, but wouldn't want it in prod.

@martrapp
Copy link
Member Author

A lot of people will dislike logging happening in their frontend application. I think in dev mode it is ok, but wouldn't want it in prod.

Then fine with me as is.

@martrapp martrapp merged commit ade9759 into main Feb 26, 2024
13 checks passed
@martrapp martrapp deleted the mt/reduced-motion branch February 26, 2024 16:04
@astrobot-houston astrobot-houston mentioned this pull request Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants