DocsResources
Get started

Search Subtly documentation

Search by a task, helper name or framework.

Resources

UX patterns

Additional UX patterns that need no JavaScript utility

Use :focus-visible for focus rings; inert for inactive regions (do not duplicate native dialog behaviour); native <dialog> or a tested accessible modal; aria-expanded and aria-controls on disclosure buttons; native form labels and autocomplete; inputmode for appropriate keyboards; explicit image dimensions or aspect-ratio; scroll-margin-top for anchored content; overscroll-behavior:contain on scrollable panels; scrollbar-gutter:stable for layout stability; responsive 44px targets where practical; visible labels and meaningful errors; preserve text selection and caret; use CSS transitions for simple reversible motion; View Transitions as progressive enhancement, not required navigation; prioritize essential content before lazy secondary widgets. Conditional disclosure must remove hidden fields from required validation and must not silently submit irrelevant data.

Testing checklist

Run npm test and npm run check (the latter requires a Unix-like shell). Open examples/index.html through a local static server from the kit directory, for example python3 -m http.server 8000. Test keyboard-only, mouse, touch and pen; zoom to 200%; RTL; reduced motion; slow network and offline errors; nested overlays; viewport edges; screen reader announcements; unmount/reopen; back navigation and logout. Ensure no controls are obstructed by invisible bridges. Test real iOS Safari scroll locking and virtual keyboard. Avoid layering these utilities over an existing component that already implements the same feature.

The included automated tests cover selected state, timing and geometry logic, not full browser behaviour or framework integration. The examples are illustrative, not complete accessible menu/dialog implementations. No general-purpose focus trap is provided: use native dialog or a mature accessibility library. Defaults are starting points, not universal UX rules.

Documentation website

See WEBSITE.md for the documentation site's local preview, editing, deployment and validation instructions. Generated pages are in docs/ and are ready for GitHub Pages.

Interaction audit

No hover-only essential actions

Keyboard and focus support

Reduced motion

Preserved form state

No duplicate requests

Responsive hit targets

No layout shift

Loading and error states

Screen reader announcements

Touch and pen testing