Lumen is a primitive library, so every screen built on it inherits its accessibility decisions, mistakes included. This post describes the keyboard and focus contract the components follow as of Lumen 4.2.0, released on October 13, and the tests that hold it in place.
Lumen’s baseline is WCAG 2.2 Level AA, a minimum rather than a finish line. The browser test suite runs axe-core with its WCAG 2.0 A and AA, 2.1 AA, and 2.2 AA rule tags against the consumer workflow examples, AI guides, and motion playground, and scans documentation guides in light and dark themes.
Scanners can tell you that a button has no name. They can’t tell you that Escape closed the wrong layer, or that focus fell back to the document body when a dialog closed. That part of the contract is behavioral, so it’s written as tests that press real keys in a real browser and assert where focus lands. Every component whose behavior comes from the Lumen runtime rather than native HTML is listed in a registry, and a test fails unless each one has an end-to-end behavior scenario.
Lumen follows the model in the WAI-ARIA Authoring Practices guide to developing a keyboard interface: Tab moves between widgets, and arrow keys move inside a composite widget. A toolbar with twelve buttons should cost one Tab stop, not twelve.
Toolbar, ToggleGroup, RadioGroup, and Menubar use a roving tabindex. One item carries tabindex="0", the rest carry -1, and the arrow keys move both focus and that single tab stop. Home and End jump to the ends, and the sequence wraps. In right-to-left layouts, Left and Right are mirrored, and the direction is read when the key is pressed, so a region whose dir changes after load still behaves correctly.
Tabs work the same way, with two refinements: selection follows focus, and disabled tabs are skipped instead of focused. A vertical tab list switches to Up and Down.
Combobox uses the other model. Focus stays in the text input while the arrow keys move a highlight through the options, and aria-activedescendant tells assistive technology which option is active, so typing, Backspace, and IME composition keep working. Mentions keeps its suggestion buttons out of the Tab sequence entirely while keyboard and pointer selection still work.
---
import { Button, Dialog, Toolbar } from '@santi020k/lumen-astro'
import UIPrimitives from '@santi020k/lumen-astro/runtime'
---
<UIPrimitives />
<Toolbar aria-label="Text formatting">
<Button>Bold</Button>
<Button>Italic</Button>
</Toolbar>
<Button data-ui-dialog-trigger="profile-dialog">Edit profile</Button>
<Dialog id="profile-dialog" aria-labelledby="profile-title">
<h2 id="profile-title">Edit profile</h2>
<Button data-ui-dialog-close>Close</Button>
</Dialog>Mount UIPrimitives once in the app shell, as the Astro guide describes, and the runtime adds roving focus, dialog wiring, and Escape handling. Without it, the toolbar is still a row of ordinary buttons that Tab reaches one by one.
Dialog, AlertDialog, Drawer, and Sheet are built on the native <dialog> element opened with showModal(). The browser makes the rest of the page inert and handles Escape, as MDN documents. Lumen adds what the platform leaves to authors:
- When a dialog closes, focus returns to the control that opened it, as long as that control is still in the document.
- An
autofocuselement inside the dialog keeps its native behavior. - A backdrop click dismisses a dialog only when the press both starts and ends outside the panel, and only for real pointer clicks. A drag from the panel onto the backdrop doesn’t discard a half-filled form.
- AlertDialog ignores backdrop presses entirely, so a confirmation needs a deliberate answer.
Popovers and dropdown menus follow the same contract. Enter, Space, or ArrowDown on the trigger opens the panel and moves focus to the first available item. ArrowUp, ArrowDown, Home, and End move through items, skipping anything disabled, hidden, inert, or invisible. Escape closes the panel and returns focus to its trigger.
Layers matter most when they nest. A Combobox inside a dialog consumes the first Escape to close its list; the second closes the dialog. Nested popovers close one at a time, each returning focus to its own trigger. Those exact key sequences are Playwright tests.
In React Native, LumenSheet accepts initialFocusRef and returnFocusRef to move screen reader focus into the sheet when it appears and back to the trigger after it closes.
The shared focus indicator is a 2px outline in the brand color with a 2px offset, applied on :focus-visible so pointer clicks don’t leave rings behind. Using an outline rather than a box-shadow matters: forced-colors mode removes box-shadows but keeps outlines and repaints them in system colors.
WCAG 2.4.7 Focus Visible only asks that focus be visible. The dark theme test asks for more. On twelve documentation routes, in both the Lumen and santi020k dark themes, it presses Tab and checks that the focused element has an outline at least 2px wide or a shadow, and that text meets 4.5:1 contrast, or 3:1 for large text. It also checks itself: one case paints a heading black on the dark canvas and asserts that the audit reports it. An audit that can’t fail isn’t evidence.
Names get the same treatment. A browser test loads every component documentation page and inspects each live preview. It fails on an interactive control without an accessible name, a duplicate id, an ARIA reference that points at nothing, an in-page link without a target, or any client-side error.
The runtime also maintains relationships authors tend to forget. Field adds its hint and error elements to the control’s aria-describedby, merging with existing IDs, and validation sets aria-invalid. Tooltip appends itself to its trigger’s description the same way. Skeleton is decorative (aria-hidden) unless you name it, and becomes role="status" when you do; Lumen 4.1 brought React and Web Components in line with Astro on that rule.
WCAG 2.2 added 2.5.8 Target Size (Minimum), which asks for pointer targets of at least 24 by 24 CSS pixels, with exceptions for spacing and inline text. Lumen’s default Button is 40px tall, the small size is 36px, and icon buttons are 40px square. Range calendar days and month navigation on narrow screens, and chart action buttons, grow to 44px. SwiftUI and React Native controls such as agenda navigation and breadcrumbs reserve 44 points. Several Compose instrumentation tests enable Android’s Accessibility Test Framework checks, which include touch-target size.
Text size matters as much on native. At a React Native font scale of 2, button groups stack instead of wrapping, and sheets make all their content scrollable.
Reduced motion isn’t an AA requirement (2.3.3 Animation from Interactions is AAA), but it’s cheap to honor. When prefers-reduced-motion: reduce matches, the stylesheet shortens every animation and transition to 1ms, runs animations once, turns off smooth scrolling, and removes the hover lift on buttons and interactive cards. Using 1ms instead of zero means code that waits for a transition to finish still gets its end event. The core motion helpers skip animation in that mode or inside data-ui-motion="reduce", and cancel one already in flight if the preference changes. React Native sheets, alert dialogs, and menus follow the system Reduce Motion setting.
A keyboard contract that holds in only one adapter isn’t a contract. The framework conformance suite runs React and Elements through the same behavior tests: tabs switch with ArrowRight, Combobox filters and commits from the keyboard and closes before its dialog, and arrows mirror under inherited RTL.
Disclosure navigation is checked by one shared helper that the Astro Popover and the React and Elements adapters all run. It injects a disabled button, a hidden one, an invisible one, an inert region, and a disabled fieldset whose legend button must stay reachable, then checks that ArrowDown, Home, and End land only on available items and that the inert region’s button returns once inert is removed.
None of this replaces a person using a screen reader on real hardware, which the README treats as its own verification step, separate from builds and published artifacts.
If you build on Lumen, the practical part is short: mount UIPrimitives once, give every dialog and icon-only control a name, and let the components own focus. If a keyboard path doesn’t match this description, open an issue with the component, the keys you pressed, and where focus ended up. That’s a bug in the contract, and its fix should arrive with a test.







