Skip to content

Add support for reduced-motion on opacity animations #6323

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

Merged
merged 3 commits into from
Jul 22, 2025

Conversation

adierkens
Copy link
Contributor

Closes https://github.com/github/primer/issues/5419

  • Adds support for reduced-motion that disables the opacity animations for TooltipV2 and Overlay (used by the Select Panel).
  • Removes the *-fetch SelectPanel visual tests
  • Uses reduced-motion in the playwright visual tests to avoid flaky screenshots related to CSS animations.

Changelog

Changed

Removes opacity animations from TooltipV2 and Overlay when prefers-reduced-motion is enabled

Rollout strategy

  • Patch release

Testing & Reviewing

Check the Tooltip and Overlay (Select Panel) components behave identically (without setting prefers-reduced-motion).

To test w/ reduced-motion in Chrome:

  • Open the dev tools
  • Use CMD + Shift + P to open the run menu
  • Type reduced
  • Click on Emulate CSS prefers-reduced-motion: reduce
  • Use the same instructions to disable

Merge checklist

Copy link

changeset-bot bot commented Jul 14, 2025

🦋 Changeset detected

Latest commit: 21d23de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

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 integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Jul 14, 2025
Copy link
Contributor

👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks!

Copy link
Contributor

github-actions bot commented Jul 14, 2025

size-limit report 📦

Path Size
packages/react/dist/browser.esm.js 91.9 KB (0%)
packages/react/dist/browser.umd.js 92.23 KB (0%)

@github-actions github-actions bot temporarily deployed to storybook-preview-6323 July 14, 2025 22:30 Inactive
@adierkens adierkens marked this pull request as ready for review July 14, 2025 22:35
@Copilot Copilot AI review requested due to automatic review settings July 14, 2025 22:35
@adierkens adierkens requested review from a team as code owners July 14, 2025 22:35
@adierkens adierkens requested a review from langermank July 14, 2025 22:35
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for prefers-reduced-motion accessibility preference to disable opacity animations in TooltipV2 and Overlay components. This improves accessibility for users who prefer reduced motion due to vestibular disorders or other motion sensitivities.

  • Wraps CSS animations in media queries to respect user's reduced motion preferences
  • Updates visual regression tests to use reducedMotion: 'reduce' for consistent screenshots
  • Removes problematic fetch-related visual tests that were causing flaky results

Reviewed Changes

Copilot reviewed 4 out of 22 changed files in this pull request and generated 1 comment.

File Description
packages/react/src/TooltipV2/Tooltip.module.css Wraps animation styles in prefers-reduced-motion media query
packages/react/src/Overlay/Overlay.module.css Moves overlay animation inside prefers-reduced-motion media query
e2e/components/TooltipV2.test.ts Updates visual tests to use reducedMotion emulation
e2e/components/SelectPanel.test.ts Updates visual tests and excludes fetch-related stories

Copy link
Contributor

@langermank langermank left a comment

Choose a reason for hiding this comment

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

These seem like good changes, though I do wonder if this issue will come up again since we're mostly relying on changes to the components to fix it. Not all animations really need to be gated by that media query but I suppose it doesn't hurt!

@adierkens
Copy link
Contributor Author

These seem like good changes, though I do wonder if this issue will come up again since we're mostly relying on changes to the components to fix it. Not all animations really need to be gated by that media query but I suppose it doesn't hurt!

Agreed. I don't love that we have to update the components to account for it -- I'm working on a small repro example to send over to playwright and hopefully get a real fix in.

@github-actions github-actions bot temporarily deployed to storybook-preview-6323 July 18, 2025 15:47 Inactive
@langermank langermank added this pull request to the merge queue Jul 22, 2025
Merged via the queue into main with commit c65abcb Jul 22, 2025
62 of 64 checks passed
@langermank langermank deleted the adierkens/vrt-harden branch July 22, 2025 18:31
@primer primer bot mentioned this pull request Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants