fix: static state under prefers-reduced-motion for ApiTagFilter (Gran… - #841
Open
brooksdevon001-star wants to merge 2 commits into
Open
Conversation
…tFox FWC26) - Add useReducedMotion hook (src/hooks/useReducedMotion.ts) that reads and subscribes to the prefers-reduced-motion media query - Add ApiTagFilter component (src/pages/ApiTagFilter.tsx) with reduced- motion support via tag-chip--no-motion modifier class - Add @media (prefers-reduced-motion: reduce) and .tag-chip--no-motion CSS rules to index.css to suppress transition/transform on chips - Add 20 focused tests covering rendering, active state, interaction, reduced-motion behaviour, and accessibility (WCAG 2.1 AA) Closes #FWC26
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.
fix: static state under prefers-reduced-motion: reduce for ApiTagFilter (GrantFox FWC26)
───────────────────────────────────────────────────────────────────────────────────────────────
Summary
Implements the ApiTagFilter component with full prefers-reduced-motion: reduce support. When a
user has enabled the OS/browser reduced-motion preference, the hover lift animation (transform:
translateY(-1px)) and CSS transition easing on tag-filter chips are suppressed — chips jump
directly to their final visual state with no movement.
Changes
src/hooks/useReducedMotion.ts (new)
Reusable hook that reads window.matchMedia('(prefers-reduced-motion: reduce)') and subscribes
to live changes, so the value stays in sync if the preference is toggled while the page is
open.
src/pages/ApiTagFilter.tsx (new)
Tag-chip filter bar component. Uses useReducedMotion() to conditionally apply a
tag-chip--no-motion modifier class to every chip when the reduced-motion preference is active.
src/index.css (modified)
Two complementary rules added after the existing .tag-chip block:
query may not cascade correctly
src/pages/ApiTagFilter.test.tsx (new)
20 focused tests covering rendering, active/inactive state, click interaction, reduced-motion
behaviour (core of FWC26), and accessibility attributes.
Accessibility
Testing
✓ src/pages/ApiTagFilter.test.tsx (20 tests) — all pass
Notes
FiltersSidebar.tsx has pre-existing unresolved git merge conflict markers that cause the
TypeScript build to fail. This is not introduced by this PR.
───────────────────────────────────────────────────────────────────────────────────────────────
Closes #701