Web Interface Guidelines
Review these files for compliance: $ARGUMENTS
Read files, check against rules below. Output concise but comprehensive—sacrifice grammar for brevity. High signal-to-noise.
Rules
Accessibility
- Icon-only buttons need
aria-label
- Form controls need
<label> or aria-label
- Interactive elements need keyboard handlers (
onKeyDown/onKeyUp)
<button> for actions, <a>/<Link> for navigation (not <div onClick>)
- Images need
alt (or alt="" if decorative)
- Decorative icons need
aria-hidden="true"
- Async updates (toasts, validation) need
aria-live="polite"
- Use semantic HTML (
<button>, <a>, <label>, <table>) before ARIA
- Headings hierarchical
<h1>–<h6>; include skip link for main content
scroll-margin-top on heading anchors
Focus States
- Interactive elements need visible focus:
focus-visible:ring-* or equivalent
- Never
outline-none / outline: none without focus replacement
- Use
:focus-visible over :focus (avoid focus ring on click)
- Group focus with
:focus-within for compound controls
Forms
- Inputs need
autocomplete and meaningful name
- Use correct
type (email, tel, url, number) and inputmode
- Never block paste (
onPaste + preventDefault)
- Labels clickable (
htmlFor or wrapping control)
- Disable spellcheck on emails, codes, usernames (
spellCheck={false})
- Checkboxes/radios: label + control share single hit target (no dead zones)
- Submit button stays enabled until request starts; spinner during request
- Errors inline next to fields; focus first error on submit
- Placeholders end with
… and show example pattern
autocomplete="off" only for a specific field where a password manager demonstrably
misfires. WCAG 1.3.5 requires the purpose of fields collecting information about the
user to be programmatically determinable, and autocomplete is how that is met — so a
blanket off on non-auth fields is a conformance failure, not a default
- Warn before navigation with unsaved changes (
beforeunload or router guard)
Animation
- Honor
prefers-reduced-motion (provide reduced variant or disable)
- Animate
transform/opacity only (compositor-friendly)
- Never
transition: all—list properties explicitly
- Set correct
transform-origin
- SVG: transforms on
<g> wrapper with transform-box: fill-box; transform-origin: center
- Animations interruptible—respond to user input mid-animation
Typography
… not ...
- Curly quotes
" " not straight "
- Non-breaking spaces:
10 MB, ⌘ K, brand names
- Loading states end with
…: "Loading…", "Saving…"
font-variant-numeric: tabular-nums for number columns/comparisons
- Use
text-wrap: balance or text-pretty on headings (prevents widows)
Content Handling
- Text containers handle long content:
truncate, line-clamp-*, or break-words
- Flex children need
min-w-0 to allow text truncation
- Handle empty states—don't render broken UI for empty strings/arrays
- User-generated content: anticipate short, average, and very long inputs
Images
<img> needs explicit width and height (prevents CLS)
- Below-fold images:
loading="lazy"
- Above-fold critical images:
priority or fetchpriority="high"
Performance
- Large lists (>50 items): virtualize (
virtua, content-visibility: auto)
- No layout reads in render (
getBoundingClientRect, offsetHeight, offsetWidth, scrollTop)
- Batch DOM reads/writes; avoid interleaving
- Prefer uncontrolled inputs; controlled inputs must be cheap per keystroke
- Add
<link rel="preconnect"> for CDN/asset domains
- Critical fonts:
<link rel="preload" as="font"> with font-display: swap
Navigation & State
- URL reflects state—filters, tabs, pagination, expanded panels in query params
- Links use
<a>/<Link> (Cmd/Ctrl+click, middle-click support)
- Deep-link all stateful UI (if uses
useState, consider URL sync via nuqs or similar)
- Destructive actions need confirmation modal or undo window—never immediate
Touch & Interaction
touch-action: manipulation (prevents double-tap zoom delay)
-webkit-tap-highlight-color set intentionally
overscroll-behavior: contain in modals/drawers/sheets
- During drag: disable text selection,
inert on dragged elements
autoFocus sparingly—desktop only, single primary input; avoid on mobile
Safe Areas & Layout
- Full-bleed layouts need
env(safe-area-inset-*) for notches
- Avoid unwanted scrollbars:
overflow-x-hidden on containers, fix content overflow
- Flex/grid over JS measurement for layout
Dark Mode & Theming
color-scheme: dark on <html> for dark themes (fixes scrollbar, inputs)
<meta name="theme-color"> matches page background
- Native
<select>: explicit background-color and color (Windows dark mode)
Locale & i18n
- Dates/times: use
Intl.DateTimeFormat not hardcoded formats
- Numbers/currency: use
Intl.NumberFormat not hardcoded formats
- Detect language via
Accept-Language / navigator.languages, not IP
Hydration Safety
- Inputs with
value need onChange (or use defaultValue for uncontrolled)
- Date/time rendering: guard against hydration mismatch (server vs client)
suppressHydrationWarning only where truly needed
Hover & Interactive States
- Buttons/links need
hover: state (visual feedback)
- Interactive states increase contrast: hover/active/focus more prominent than rest
Content & Copy
- Active voice: "Install the CLI" not "The CLI will be installed"
- Sentence case for headings and buttons is the safer default: no per-word case rules and it
localizes cleanly. Use Title Case only where a brand or navigation convention requires it,
and then consistently per element type
- Numerals for counts: "8 deployments" not "eight"
- Specific button labels: "Save API Key" not "Continue"
- Error messages include fix/next step, not just problem
- Second person; avoid first person
& over "and" where space-constrained
Anti-patterns (flag these)
user-scalable=no or maximum-scale=1 disabling zoom
onPaste with preventDefault
transition: all
outline-none without focus-visible replacement
- Inline
onClick navigation without <a>
<div> or <span> with click handlers (should be <button>)
- Images without dimensions
- Large arrays
.map() without virtualization
- Form inputs without labels
- Icon buttons without
aria-label
- Hardcoded date/number formats (use
Intl.*)
autoFocus without clear justification
Output Format
Group by file. Use file:line format (VS Code clickable). Terse findings.
## src/Button.tsx
src/Button.tsx:42 - icon button missing aria-label
src/Button.tsx:18 - input lacks label
src/Button.tsx:55 - animation missing prefers-reduced-motion
src/Button.tsx:67 - transition: all → list properties
## src/Modal.tsx
src/Modal.tsx:12 - missing overscroll-behavior: contain
src/Modal.tsx:34 - "..." → "…"
## src/Card.tsx
✓ pass
State issue + location. Skip explanation unless fix non-obvious. No preamble.
1---2name: web-interface-guidelines3description: "Review UI code against the Vercel Web Interface Guidelines: a broad, terse pre-commit sweep across interaction, forms, layout, content, performance, and accessibility. Use for a fast checklist pass over a diff. For depth in any single domain, and for a holistic cross-discipline review, use the better-* suite instead."4license: MIT5metadata:6 version: "1.0.0"7 argument-hint: "<file-or-pattern>"8---910# Web Interface Guidelines1112Review these files for compliance: $ARGUMENTS1314Read files, check against rules below. Output concise but comprehensive—sacrifice grammar for brevity. High signal-to-noise.1516## Rules1718### Accessibility1920- Icon-only buttons need `aria-label`21- Form controls need `<label>` or `aria-label`22- Interactive elements need keyboard handlers (`onKeyDown`/`onKeyUp`)23- `<button>` for actions, `<a>`/`<Link>` for navigation (not `<div onClick>`)24- Images need `alt` (or `alt=""` if decorative)25- Decorative icons need `aria-hidden="true"`26- Async updates (toasts, validation) need `aria-live="polite"`27- Use semantic HTML (`<button>`, `<a>`, `<label>`, `<table>`) before ARIA28- Headings hierarchical `<h1>`–`<h6>`; include skip link for main content29- `scroll-margin-top` on heading anchors3031### Focus States3233- Interactive elements need visible focus: `focus-visible:ring-*` or equivalent34- Never `outline-none` / `outline: none` without focus replacement35- Use `:focus-visible` over `:focus` (avoid focus ring on click)36- Group focus with `:focus-within` for compound controls3738### Forms3940- Inputs need `autocomplete` and meaningful `name`41- Use correct `type` (`email`, `tel`, `url`, `number`) and `inputmode`42- Never block paste (`onPaste` + `preventDefault`)43- Labels clickable (`htmlFor` or wrapping control)44- Disable spellcheck on emails, codes, usernames (`spellCheck={false}`)45- Checkboxes/radios: label + control share single hit target (no dead zones)46- Submit button stays enabled until request starts; spinner during request47- Errors inline next to fields; focus first error on submit48- Placeholders end with `…` and show example pattern49- `autocomplete="off"` only for a specific field where a password manager demonstrably50 misfires. WCAG 1.3.5 requires the purpose of fields collecting information about the51 user to be programmatically determinable, and `autocomplete` is how that is met — so a52 blanket `off` on non-auth fields is a conformance failure, not a default53- Warn before navigation with unsaved changes (`beforeunload` or router guard)5455### Animation5657- Honor `prefers-reduced-motion` (provide reduced variant or disable)58- Animate `transform`/`opacity` only (compositor-friendly)59- Never `transition: all`—list properties explicitly60- Set correct `transform-origin`61- SVG: transforms on `<g>` wrapper with `transform-box: fill-box; transform-origin: center`62- Animations interruptible—respond to user input mid-animation6364### Typography6566- `…` not `...`67- Curly quotes `"` `"` not straight `"`68- Non-breaking spaces: `10 MB`, `⌘ K`, brand names69- Loading states end with `…`: `"Loading…"`, `"Saving…"`70- `font-variant-numeric: tabular-nums` for number columns/comparisons71- Use `text-wrap: balance` or `text-pretty` on headings (prevents widows)7273### Content Handling7475- Text containers handle long content: `truncate`, `line-clamp-*`, or `break-words`76- Flex children need `min-w-0` to allow text truncation77- Handle empty states—don't render broken UI for empty strings/arrays78- User-generated content: anticipate short, average, and very long inputs7980### Images8182- `<img>` needs explicit `width` and `height` (prevents CLS)83- Below-fold images: `loading="lazy"`84- Above-fold critical images: `priority` or `fetchpriority="high"`8586### Performance8788- Large lists (>50 items): virtualize (`virtua`, `content-visibility: auto`)89- No layout reads in render (`getBoundingClientRect`, `offsetHeight`, `offsetWidth`, `scrollTop`)90- Batch DOM reads/writes; avoid interleaving91- Prefer uncontrolled inputs; controlled inputs must be cheap per keystroke92- Add `<link rel="preconnect">` for CDN/asset domains93- Critical fonts: `<link rel="preload" as="font">` with `font-display: swap`9495### Navigation & State9697- URL reflects state—filters, tabs, pagination, expanded panels in query params98- Links use `<a>`/`<Link>` (Cmd/Ctrl+click, middle-click support)99- Deep-link all stateful UI (if uses `useState`, consider URL sync via nuqs or similar)100- Destructive actions need confirmation modal or undo window—never immediate101102### Touch & Interaction103104- `touch-action: manipulation` (prevents double-tap zoom delay)105- `-webkit-tap-highlight-color` set intentionally106- `overscroll-behavior: contain` in modals/drawers/sheets107- During drag: disable text selection, `inert` on dragged elements108- `autoFocus` sparingly—desktop only, single primary input; avoid on mobile109110### Safe Areas & Layout111112- Full-bleed layouts need `env(safe-area-inset-*)` for notches113- Avoid unwanted scrollbars: `overflow-x-hidden` on containers, fix content overflow114- Flex/grid over JS measurement for layout115116### Dark Mode & Theming117118- `color-scheme: dark` on `<html>` for dark themes (fixes scrollbar, inputs)119- `<meta name="theme-color">` matches page background120- Native `<select>`: explicit `background-color` and `color` (Windows dark mode)121122### Locale & i18n123124- Dates/times: use `Intl.DateTimeFormat` not hardcoded formats125- Numbers/currency: use `Intl.NumberFormat` not hardcoded formats126- Detect language via `Accept-Language` / `navigator.languages`, not IP127128### Hydration Safety129130- Inputs with `value` need `onChange` (or use `defaultValue` for uncontrolled)131- Date/time rendering: guard against hydration mismatch (server vs client)132- `suppressHydrationWarning` only where truly needed133134### Hover & Interactive States135136- Buttons/links need `hover:` state (visual feedback)137- Interactive states increase contrast: hover/active/focus more prominent than rest138139### Content & Copy140141- Active voice: "Install the CLI" not "The CLI will be installed"142- Sentence case for headings and buttons is the safer default: no per-word case rules and it143 localizes cleanly. Use Title Case only where a brand or navigation convention requires it,144 and then consistently per element type145- Numerals for counts: "8 deployments" not "eight"146- Specific button labels: "Save API Key" not "Continue"147- Error messages include fix/next step, not just problem148- Second person; avoid first person149- `&` over "and" where space-constrained150151### Anti-patterns (flag these)152153- `user-scalable=no` or `maximum-scale=1` disabling zoom154- `onPaste` with `preventDefault`155- `transition: all`156- `outline-none` without focus-visible replacement157- Inline `onClick` navigation without `<a>`158- `<div>` or `<span>` with click handlers (should be `<button>`)159- Images without dimensions160- Large arrays `.map()` without virtualization161- Form inputs without labels162- Icon buttons without `aria-label`163- Hardcoded date/number formats (use `Intl.*`)164- `autoFocus` without clear justification165166## Output Format167168Group by file. Use `file:line` format (VS Code clickable). Terse findings.169170```text171## src/Button.tsx172173src/Button.tsx:42 - icon button missing aria-label174src/Button.tsx:18 - input lacks label175src/Button.tsx:55 - animation missing prefers-reduced-motion176src/Button.tsx:67 - transition: all → list properties177178## src/Modal.tsx179180src/Modal.tsx:12 - missing overscroll-behavior: contain181src/Modal.tsx:34 - "..." → "…"182183## src/Card.tsx184185✓ pass186```187188State issue + location. Skip explanation unless fix non-obvious. No preamble.