Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
## 2026-07-12 - Toggle Switch Accessibility

**Learning:** Custom UI toggle buttons without proper `role` or `aria-checked` attributes leave screen reader users completely unaware of the component's state or purpose. Adding `role="switch"` and standardizing keyboard focus (via `focus-visible`) makes these ubiquitous micro-interactions accessible.
**Action:** When implementing custom toggle inputs that deviate from standard checkboxes, explicitly define `role="switch"`, bind `aria-checked` to the state boolean, and add `type="button"` to prevent accidental form submission.
6 changes: 5 additions & 1 deletion src/components/settings/UserPreferencesModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,13 @@ function ToggleRow({ label, description, checked, onChange, icon: Icon }: Toggle
</div>
</div>
<button
type="button"
role="switch"
aria-checked={checked}
aria-label={label}
onClick={() => onChange(!checked)}
className={cn(
'relative h-6 w-11 rounded-full transition-colors',
'relative h-6 w-11 rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#6C63FF] focus-visible:ring-offset-2',
checked ? 'bg-[#6C63FF]' : 'bg-[#D1D5DB]'
)}
>
Expand Down
Loading