Accessibility Primitives Double as an Agent Control Plane

repouiaccessibilityaiagentstypescriptheadless-uiweb-componentstesting

Its semantic snapshot/action bridge and required agent tests map directly to JoelClaw's agent-first UI work and the Testing JavaScript discussion.

Vercel Labs built UI SDK below the component layer. Keyboard navigation, focus recovery, selection, dismissal, popups, drag and drop, and ARIA live in @ui-sdk/core. Thin adapters render the same behaviors through React, Vue, Svelte, Solid, or Web Components.

The clever bit is that the accessibility model becomes the agent model. createAgent snapshots controls by accessible name, exposes typed actions, marks changes with source === "agent", and lets the application refuse them. data-agent-confirm, data-agent-secret, and data-agent-hidden make confirmation, secrecy, and visibility part of the interface contract instead of prompt folklore. An agent acts on “Project name” or “Visibility” through the component API rather than guessing at pixels and replaying clicks.

The repo also ships a version-matched ui-sdk agent skill inside @ui-sdk/core. It tells agents to read installed docs, compose missing primitives from shared behaviors, preserve keyboard and right-to-left support, and prove the result with an agent-facing test. That makes this especially relevant to the Artem Zakharchenko / Testing JavaScript discussion: the test checks whether an agent can discover and operate the interface through its public semantics. The project is still beta, but the architecture is already worth stealing for JoelClaw: accessibility, automation, and testing share one behavioral core instead of becoming three separate systems.

Key Ideas

  • definePrimitive separates behavior from rendering, so one keyboard, focus, selection, and ARIA implementation can serve five framework adapters.
  • createParts gives each framework the same root-and-slots component shape while keeping adapters generic and free of component-specific logic.
  • createAgent turns accessible names, component state, and declared API methods into a semantic snapshot and action surface for agents.
  • Agent-originated changes travel through normal change callbacks, where applications can identify them with source === "agent" and cancel them without inventing a second mutation path.
  • The shipped ui-sdk skill treats tests as part of generated UI work, including keyboard behavior, focus, server rendering, right-to-left layouts, ARIA, and agent operability.
  • The repo’s own architecture enforces downward imports and shared engines for lists, roving focus, overlays, shortcuts, forms, and agent actions.
  • Apache License 2.0 makes the implementation available for study and reuse, while the beta label warns that APIs and behaviors can still move.