USWDS - Core: Add transition utility with reduced motion preference handling #6268
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Animated transitions now respect the system's reduced motion preference. A new transition utility handles default behavior for easing and disabling inessential animation.
Breaking change
This is not a breaking change.
Related issue
Closes #5256
Preview link
In local Storybook, can be previewed at:
Problem statement
As a user who may be distracted or experience harm such as nausea due to animated content, I expect that the U.S. Web Design System will respect my preference to experience reduced motion where possible.
Related:
Solution
Adds a new utility
u-transition
with smart defaults to handle:$essential
argument (defaultfalse
) to control whether transition is disabled when reduced motion is preferredRelated:
Testing and review
See "Preview links" above.
Unless system preferences are configured to prefer reduced motion, there should be no changes in the appearance of animated transition effects.
Instructions for configuring reduced motion preference:
Before opening this PR, make sure you’ve done whichever of these applies to you:
git pull origin [base branch]
to pull in the most recent updates from your base and check for merge conflicts. (Often, the base branch isdevelop
).npm run prettier:sass
to format any Sass updates.npm test
and confirm that all tests pass.