Skip to content

fix: resolve five accessibility problems - #115

Open
rahulkr182 wants to merge 1 commit into
paro-studio:mainfrom
rahulkr182:fix/accessibility-improvements
Open

fix: resolve five accessibility problems#115
rahulkr182 wants to merge 1 commit into
paro-studio:mainfrom
rahulkr182:fix/accessibility-improvements

Conversation

@rahulkr182

Copy link
Copy Markdown
Contributor

What does this change?

Fixes #99

Addresses the five accessibility issues identified in the issue:

  1. Dark mode border contrast: Increased --border, --input, and --sidebar-border from 220 12% 16% to 220 12% 40% in src/index.css. The contrast ratio against --background: 220 15% 6% is now 3.13:1 (and 3.02:1 against --card: 220 15% 8%), hitting the WCAG 2.1 3:1 non-text contrast requirement.
  2. Text below 12px: Replaced all instances of text-[10px] and text-[11px] across src/pages/PromptDetail.tsx, src/components/prompts/PromptCard.tsx, and src/components/prompts/SharePromptDialog.tsx with text-xs (12px / 0.75rem).
  3. Hardcoded black over user images: Replaced text-black on the mobile menu trigger in src/components/prompts/PromptCard.tsx with an accessible frosted button (rounded-full bg-background/80 hover:bg-background/90 text-foreground backdrop-blur-sm border border-border/50 shadow-sm), guaranteeing legibility over both dark and light user images.
  4. Reduced motion: Added a global @media (prefers-reduced-motion: reduce) block in src/index.css setting animation/transition durations to 0.01ms and scroll-behavior to auto.
  5. Delete confirmation modal: Replaced the raw hand-rolled fixed inset-0 modal in src/components/prompts/PromptCard.tsx with Radix UI Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, and DialogFooter, giving it focus trapping, Escape-to-close, scroll locking, and accessible dialog roles.
  6. Accessibility automated tests: Added tests in src/components/prompts/PromptCard.test.tsx and src/accessibility.test.ts to assert contrast ratio >= 3:1, reduced motion styles, absence of sub-12px text, and dialog focus trap semantics.

Why?

  • Dark mode borders were virtually invisible at ~1.3:1 contrast against the background.
  • Sub-12px text made muted metadata difficult to read for people with low vision.
  • Hardcoded black icon without a solid backing became unreadable when overlaid on dark user-uploaded images.
  • Animations did not honor the system's prefers-reduced-motion accessibility setting for vestibular disorders.
  • The prompt delete action used a raw div modal lacking focus trap, Escape key handling, and ARIA dialog semantics.

How was it tested?

  • Added automated tests in src/components/prompts/PromptCard.test.tsx to verify Radix dialog accessibility and mobile menu overlay styling.
  • Added automated tests in src/accessibility.test.ts checking WCAG contrast ratio, prefers-reduced-motion declaration, and text sizing.
  • Ran all CI validation commands locally:
    • npm run lint (0 errors)
    • npm run typecheck (0 errors)
    • npm test (all 16 test files and 85 tests passed)
    • npm run build (production build succeeded)
    • npm run db:schema:check (up to date)

Checklist

  • npm run lint passes
  • npm run typecheck passes
  • npm test passes
  • npm run build passes
  • Any new root-relative asset (/foo.png) is in public/, not src/assets/
  • No credentials, keys, or .env files are included
  • I've read the CLA in CONTRIBUTING.md

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.

bug: five accessibility problems worth fixing

1 participant