diff --git a/.claude/skills/accessibility/SKILL.md b/.claude/skills/accessibility/SKILL.md new file mode 100644 index 000000000..6b30fa13a --- /dev/null +++ b/.claude/skills/accessibility/SKILL.md @@ -0,0 +1,145 @@ +--- +name: accessibility +description: Accessibility patterns and requirements for this project. Use when creating interactive components, forms, dialogs, or any user-facing UI. +--- + +# Accessibility Patterns + +This project builds on **shadcn/ui** primitives which provide strong built-in a11y. Follow these patterns to maintain that standard. + +## ARIA Labels + +All interactive elements without visible text must have an `aria-label`: + +```typescript +// Icon buttons + + +// Folder toggles +
+``` + +## Form Accessibility + +Link inputs to labels and error messages: + +```typescript + +{!!error && {error.join("\n")}} +
{hint}
+``` + +Use the shadcn/ui `Label` component for proper form associations. + +## Keyboard Navigation + +### Required keyboard support for custom interactive elements: + +- **Enter/Space**: Activate buttons and toggles +- **Escape**: Close dialogs, cancel editing, deselect +- **Tab**: Move focus between interactive elements + +```typescript +// The Input component has built-in onEnter and onEscape props + + +// For non-Input elements, handle manually +onKeyDown={(e) => { + if (e.key === "Enter" && !e.shiftKey) { + e.preventDefault(); + save(); + } else if (e.key === "Escape") { + e.preventDefault(); + cancel(); + } +} +``` + +### Non-button clickable elements need `role="button"` and `tabIndex={0}`: + +```typescript +
+ {content} +
+``` + +### Dialogs must prevent keyboard shortcuts from leaking to the canvas: + +The dialog component already handles this — use `preventKeyboardPropagation` prop when needed. This stops Ctrl+A, Ctrl+C, Ctrl+V, Tab, Enter, and Escape from reaching React Flow. + +## Screen Reader Support + +Use `sr-only` class for visually hidden but screen-reader-accessible text: + +```typescript +// Close buttons with only an icon + + + Close + + +// Command palette title + + {title} + {description} + +``` + +## Semantic HTML + +Use proper semantic elements and ARIA roles: + +```typescript +// Navigation +