Repository navigation
AvatarStack: respect prefers-reduced-motion for the hover expansion - #8654
Open
adityalenova wants to merge 1 commit into
Open
adityalenova wants to merge 1 commit into
adityalenova wants to merge 1 commit into
Conversation
The reveal slides each avatar across the screen, so the transition belongs behind @media (prefers-reduced-motion: no-preference) the way Skeleton, ProgressBar and SegmentedControl already do. The expanded positions come from the :hover rules, so with motion reduced every avatar is still revealed - just without the 200ms slide. End states are unchanged, so the existing baselines still apply.
🦋 Changeset detectedLatest commit: 265fa57 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
AvatarStackslides its avatars apart on hover regardless of the visitor's motion preference. Closes #8649..AvatarItemdeclared:The
marginpart moves avatars across the screen, which is whatprefers-reduced-motionis for. The rest of the library already opts in to motion rather than out of it —Skeleton,ProgressBar,SegmentedControl,Breadcrumbs,TooltipV2all wrap their animation or transition declarations in@media (prefers-reduced-motion: no-preference)— so this bringsAvatarStackin line with them.How
The transition goes inside the media query and nothing else moves. The expanded positions come from the
:hover/:focus-withinrules further down the file, so with motion reduced the stack still reveals every avatar, it just gets there in the same frame:Verification
Two e2e tests added to
e2e/components/AvatarStack.test.ts. They assert the behaviour rather than the stylesheet — the reduced-motion one measures the last avatar's position before and after hovering to prove the reveal still happens:reducedMotion: 'reduce'→ computedtransition-property: allwithtransition-duration: 0s, and hovering the body still moves the last avatar to a largerxand leaves it visible.reducedMotion: 'no-preference'→transition-propertystill containsmarginand the duration is0.2s, 0.2s, 0.2s, 0.2s.npx stylelint packages/react/src/AvatarStack/AvatarStack.module.cssreports no new problems (the three--stackSize-*warnings are pre-existing, at lines 26-34), andnpx prettier --checkpasses on all three files.A changeset is included (
patch).Notes
The end states are identical in both branches of the media query, so the existing visual regression baselines should hold. Playwright's
animations: 'disabled'(set inplaywright.config.tsfortoHaveScreenshot) already fast-forwards the animated path to those same end states, so mid-transition pixels were never part of a baseline.