Listoca
Customization

UI rules

Class names, cursors, keyboard use and accessibility in the web app and the marketing site, and the checks that hold them.

The web app, the marketing site and the shared components in packages/ui follow these rules. Lint and tests catch most breaks; the rest is for review.

Class names

Compose classes with cn from @listoca/ui/lib/utils (the cn package, clsx and tailwind-merge in one). It joins the parts and drops conflicting Tailwind classes, so a later px-4 wins over an earlier px-2:

<span className={cn("size-2 rounded-full", unread ? "bg-brand" : "bg-transparent")} />
<Card className={cn("p-6", className)} />

Not template literals, + or […].join(" "): a missing space joins two classes, and conflicting classes both stay. scripts/class-names.test.ts fails on any of them in a className (the native app is left out; it styles through NativeWind).

Cursor

Everything clickable shows the pointer. A base rule in packages/ui/src/styles/globals.css gives it to links, buttons, summaries, selects, labels with for, checkboxes and radios, and the roles Base UI renders (tab, menu item, option, switch, radio, checkbox, combobox), unless they're disabled. Components don't add cursor-pointer. If something clickable shows the arrow, it is probably not a button or a link, and that is the bug to fix. Cursor utilities such as cursor-not-allowed still override the rule.

Interactive elements

  • Clickable things are <button>, <Link> or <a href>, or a primitive from packages/ui; never onClick on a div or span. They come with focus, Enter and Space, and their role.
  • A set of choices drawn as cards or segments is a radio group. Segmented (@listoca/ui/components/segmented) is a row of options (the admin user filter, the pricing interval); Radio and RadioGroup (@listoca/ui/components/radio) take any look (the theme picker in theme-setting.tsx). Tab reaches the group, arrow keys move the choice.
  • Menus, dialogs, popovers, selects and tabs come from packages/ui. Base UI handles their keyboard use: arrow keys, Escape, focus kept in a dialog and returned when it closes.

Names and ARIA

  • Every control has an accessible name: its text, an aria-label on an icon-only button, or an sr-only span. The name is a translation key like any other text.
  • Decorative icons get aria-hidden.
  • Form fields have a label, and an error is tied to its field with aria-invalid and aria-describedby. TextField (apps/web/src/components/forms/text-field.tsx) does both.
  • A table column without a visible header (actions) gets an sr-only header, common.actions.
  • Error banners take role="alert"; messages that update in place take role="status".
  • Native elements first. ARIA is for what HTML can't say (aria-current, aria-expanded) and never contradicts the element's role.

Keyboard and focus

  • Everything works with Tab, Shift+Tab, Enter, Space and Escape, in the visual order. No positive tabIndex.
  • Focus stays visible: the components draw a focus-visible ring. Removing an outline needs a replacement.
  • A page has one <main>, owned by the shell: the sidebar, rail and top bar shells in the web app, the layout in apps/marketing/src/routes/{-$locale}/route.tsx. It carries id={mainContentId} and tabIndex={-1}, and a SkipLink (@listoca/ui/components/skip-link) before the navigation jumps to it. A layout inside a shell, like SettingsLayout, renders no <main> of its own.

Color, motion and size

  • Text keeps 4.5:1 contrast with its surface in every design and theme (WCAG AA). packages/ui/src/design.test.ts computes the token pairs (text on background, card, muted, popover, primary, secondary, brand, hero, sidebar) and fails below that. A new design or a color change has to pass. The test sees tokens, not pages: the axe checks in E2E run on the active design only, so after a palette change run them with that design switched on (bun run design <name>).
  • A design whose page shows a wallpaper behind its surfaces (desktop's teal) keeps --background for the surfaces and sets --wallpaper, --wallpaper-foreground and --wallpaper-muted-foreground for text straight on it; the test checks those pairs too.
  • The brand color is also text (text-brand, text-brand-ink for small text). A light brand, like an orange, may need a slightly darker shade to stay readable as text on the background.
  • With reduced motion asked for, animations and transitions end at once (a rule in globals.css); spinners keep turning so loading still shows. Nothing should carry meaning in motion alone.
  • Touch targets are at least 24 px, as the smallest button sizes are; checkboxes and switches widen their hit area past their box.

The checks

CheckCatches
oxlint's jsx-a11y plugin (.oxlintrc.json, in bun run check)click handlers on non-interactive elements, missing alt, empty links and headings, bad ARIA
scripts/class-names.test.tsclass names built from strings
packages/ui/src/design.test.tstext tokens below 4.5:1 on their surface
expectAccessible(page) (e2e/accessibility.ts, axe-core)WCAG 2.2 AA violations on a rendered page, contrast included
expectSkipLink(page)the skip link as the first Tab stop, moving the focus to <main>

Three jsx-a11y rules are off. control-has-associated-label can't see a label passed through render or a child component. prefer-tag-over-role objects to the roles Base UI renders on spans. no-autofocus would forbid dialogs and code entry focusing their one field. The vendored label and input-group components skip the rules their shadcn source breaks on purpose.

The E2E suites run expectAccessible on the sign-in pages, the dashboard, the settings pages, the admin area and the marketing pages (apps/*/tests/accessibility.spec.ts). A new page with a flow of its own gets a call in its test.

On this page