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

Switch animation obeys prefers-reduced-motion #488

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

ty2k
Copy link
Contributor

@ty2k ty2k commented Sep 12, 2024

This updates the Switch component to add prefers-reduced-motion rules to its transition style rules. This has the effect of removing the animation when a user has set up their browser (or OS) to reduce the amount of motion they see.

See MDN's prefers-reduced-motion User Preferences for instructions on changing this setting to test.

Chrome in macOS with "Reduce motion" turned on:
https://github.com/user-attachments/assets/0fde3d9e-203b-4ec1-9f19-21540cc4aeda

Turned off (default):
https://github.com/user-attachments/assets/7339dbb6-e00f-4667-9e8e-57304df10eaa

@ty2k ty2k added the enhancement New feature or request label Sep 12, 2024
@ty2k ty2k added this to the Components v0.3.0 milestone Sep 12, 2024
@ty2k ty2k requested a review from mkernohanbc September 12, 2024 22:28
@ty2k ty2k self-assigned this Sep 12, 2024
Copy link
Contributor

@mkernohanbc mkernohanbc left a comment

Choose a reason for hiding this comment

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

Good catch!

@ty2k ty2k merged commit dc3d928 into main Sep 12, 2024
4 checks passed
@ty2k ty2k deleted the feature/prefer-reduced-motion-for-switch branch September 12, 2024 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants