Skip to content

fix(uiux): prefers-reduced-motion, focus trap, console.log cleanup - #217

Merged
ajianaz merged 1 commit into
developfrom
fix/uiux-audit
Aug 8, 2026
Merged

fix(uiux): prefers-reduced-motion, focus trap, console.log cleanup#217
ajianaz merged 1 commit into
developfrom
fix/uiux-audit

Conversation

@ajianaz

@ajianaz ajianaz commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Ringkasan

Tiga fix accessibility & code quality dari Corin UI/UX Audit (menggunakan skill hallmark + better-interface):

Changes

1. prefers-reduced-motion support — a11y critical

Problem: Zero prefers-reduced-motion globally. User dengan vestibular disorder atau motion sensitivity tidak ada way untuk mengurangi animasi.

Fix:

  • src/app.css — Global @media (prefers-reduced-motion: reduce) guard: disable semua CSS animations & transitions (animation-duration: 0.01ms, transition-duration: 0.01ms, scroll-behavior: auto)
  • src/lib/components/GraphView.svelte — JS-driven motion guard: skip physics simulation loop + pulse animation saat matchMedia('(prefers-reduced-motion: reduce)') aktif. Nodes render di posisi awal tanpa continuous RAF redraw.

WCAG: 2.3.3 Animation from Interactions (Level AAA)

2. Focus trap di DetailPanel — WCAG 2.4.3

Problem: role="dialog" aria-modal="true" tanpa focus trap. Tab bisa keluar panel ke background UI — violates ARIA dialog pattern.

Fix:

  • src/lib/components/DetailPanel.svelte — Full focus management:
    • Tab/Shift+Tab cycling dalam dialog (query focusable elements)
    • Auto-focus first focusable element on mount
    • Restore focus ke trigger element on close
    • tabindex="-1" on panel untuk fallback focus

WCAG: 2.4.3 Focus Order (Level A)

3. Remove console.log di MemoryDetail — code hygiene

Problem: Dead debug console.log di handleDocClick — polluted production console.

Fix: Replaced dengan intentional no-op + comment. Parameter renamed ke _slug untuk clarity.


Audit findings reference

ID Finding Severity Status
B1 No prefers-reduced-motion support Critical ✅ Fixed
H5 GraphView physics ignores reduced-motion High ✅ Fixed
B3 DetailPanel no focus trap High ✅ Fixed
B6 console.log in production code Low ✅ Fixed
B2 Keyboard-inaccessible role="button" divs Medium ❌ False positive — all have tabindex="0" + onkeydown

Test plan

  • Toggle OS reduced-motion setting → verify CSS animations stop globally
  • With reduced-motion ON → open GraphView → verify no physics jiggle, static render
  • Open memory detail panel → Tab cycle → verify focus stays within panel
  • Close panel → verify focus returns to clicked memory card
  • Check browser console → no [MemoryDetail] debug output
  • Run cargo test + bun run test → all pass

🤓

Three accessibility & code quality fixes from UI/UX audit (Hallmark +
better-interface skills):

1. prefers-reduced-motion (a11y critical)
   - Global @media guard in app.css: disables all CSS animations &
     transitions when user prefers reduced motion
   - GraphView: skip physics simulation + pulse animation when
     prefers-reduced-motion is active (JS-driven motion)

2. Focus trap in DetailPanel (WCAG 2.1 SC 2.4.3)
   - dialog[aria-modal=true] now properly traps Tab/Shift+Tab
   - Auto-focuses first focusable element on mount
   - Restores focus to trigger element on close

3. Remove debug console.log in MemoryDetail (code hygiene)
   - handleDocClick was a dead no-op logging call
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit c08dd0c into develop Aug 8, 2026
8 checks passed
@ajianaz
ajianaz deleted the fix/uiux-audit branch August 8, 2026 04:43
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.

1 participant