Skip to content

fix: static state under prefers-reduced-motion for ApiTagFilter (Gran… - #841

Open
brooksdevon001-star wants to merge 2 commits into
CalloraOrg:mainfrom
brooksdevon001-star:fix/api-tag-filter-reduced-motion
Open

fix: static state under prefers-reduced-motion for ApiTagFilter (Gran…#841
brooksdevon001-star wants to merge 2 commits into
CalloraOrg:mainfrom
brooksdevon001-star:fix/api-tag-filter-reduced-motion

Conversation

@brooksdevon001-star

Copy link
Copy Markdown
Contributor

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:

  • @media (prefers-reduced-motion: reduce) — CSS-level safety net that works regardless of JS
  • .tag-chip--no-motion — JS-side mirror applied by the hook for environments where the media
    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

  • role="group" + aria-label on the wrapper (WCAG 2.1 AA)
  • Each chip is a with aria-pressed for toggle semantics
  • Accessible label includes the tag name for screen readers
  • Fully keyboard navigable; no disabled attributes

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

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add reduced-motion fallback for ApiTagFilter animations [b#024]

1 participant