Skip to content

fix(a11y): respect prefers-reduced-motion in BackToTopButton#3226

Open
Shan7Usmani wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Shan7Usmani:feat/scroll-top-reduced-motion-3149
Open

fix(a11y): respect prefers-reduced-motion in BackToTopButton#3226
Shan7Usmani wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Shan7Usmani:feat/scroll-top-reduced-motion-3149

Conversation

@Shan7Usmani

Copy link
Copy Markdown

Summary

Adds prefers-reduced-motion support to the existing BackToTopButton component so users who prefer reduced animations get instant scroll behavior instead of smooth transitions.

Closes #3149

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📝 Documentation update
  • ♻️ Refactor / code cleanup (no functional change)
  • ⚡ Performance improvement
  • 🔒 Security fix
  • 🧪 Tests only

What Changed

  • src/components/BackToTopButton.tsx — Added prefersReducedMotion check using window.matchMedia("(prefers-reduced-motion: reduce)"). Scroll behavior uses "auto" instead of "smooth" when reduced motion is preferred. Progress ring SVG transition is disabled via !transition-none Tailwind class for reduced motion users.

How to Test

  1. Open DevTrack dashboard and scroll down past 300px to reveal the Back to Top button
  2. Click the button — should smooth scroll to top (default behavior)
  3. Enable "Reduce motion" in OS accessibility settings (Windows: Settings > Accessibility > Visual effects > Animation effects; macOS: System Settings > Accessibility > Display > Reduce motion)
  4. Scroll down again and click the button — should instantly jump to top without animation
  5. Verify the progress ring around the button also snaps without transition

Expected result: Button scrolls smoothly by default, instantly jumps when reduced motion is preferred. No visual regressions on the button appearance or positioning.


Checklist

  • Linked the related issue above
  • Self-reviewed my own diff
  • No unnecessary console.log, debug code, or commented-out blocks
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Added or updated tests where applicable
  • Updated documentation / comments if behavior changed

Accessibility (UI changes only)

  • Keyboard navigation works correctly
  • Color contrast meets WCAG AA standard
  • ARIA labels / roles added where needed (existing aria-label="Back to top" preserved)
  • Tested on mobile / responsive layout

Additional Context

The BackToTopButton component already existed globally in providers.tsx and met all other acceptance criteria from the issue (300px threshold, smooth scroll, hidden near top, responsive, aria-label). This PR adds the missing prefers-reduced-motion a11y support.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:accessibility GSSoC type bonus: accessibility (+15 pts) type:bug GSSoC type bonus: bug fix type:testing GSSoC type bonus: tests (+10 pts) type:feature GSSoC type bonus: new feature type:design GSSoC type bonus: UI/design (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) and removed gssoc26 GSSoC 2026 contribution type:testing GSSoC type bonus: tests (+10 pts) type:accessibility GSSoC type bonus: accessibility (+15 pts) labels Jul 22, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Shan7Usmani
Shan7Usmani force-pushed the feat/scroll-top-reduced-motion-3149 branch from 86bba0a to c925bff Compare July 22, 2026 22:18
@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:accessibility GSSoC type bonus: accessibility (+15 pts) type:testing GSSoC type bonus: tests (+10 pts) labels Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:accessibility GSSoC type bonus: accessibility (+15 pts) type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts) type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Add a Floating "Scroll to Top" Button for the Agents List

1 participant