NAC v2.0 demo

Native Accessibility Contract -- v2.0

Showcase de los 8 primitivos nuevos + HMAC mandatory + isTrusted attestation + i18n contract L1.

← Compare with v1.9 demo (example.php)

1. Scope hierarchy constructor

NAC v2.0 introduces NAC.scope() so slugs derive from the tree: shell -> section -> button auto-becomes "shell.section1.btn-go". Click below; the manifest entry includes parent_chain.

/* output here */

2. autoRegister (DOM-driven)

Click "+ Add card" to inject a card at runtime. The card has [data-nac-action] -- NAC autoRegisters it under the current scope without any manual NAC.register() call.

3. Adopt third-party (non-compliant)

The yellow "third-party widget" has zero NAC attributes. We adopt it via NAC.adopt({selector, derive}). After adoption the widget appears in the manifest with derived label_i18n + slug.

Third-party (no NAC)

4. HMAC mandatory + isTrusted attestation

At NAC-3 strict, agent-source events MUST sign with HMAC and user-source events MUST have user_gesture_attested=true (from Event.isTrusted). Try both buttons -- the "agent" button signs automatically; the "synthetic" button bypasses isTrusted.

5. i18n contract (L1: format + resolver + lint)

Switch locale; every data-i18n-key on this page re-resolves. NAC does NOT mutate the DOM directly -- the demo's host code does. NAC validates that every key has all 10 locales.

6. declareVirtual (virtualized list)

1000-row list; only ~10 in DOM at a time. NAC declares all 1000 slugs via resolver. The agent can NAC.find('rows.472') and the runtime calls the resolver on demand.

7. captureEphemeral (transient UI)

A toast appears for 3s and disappears. captureEphemeral logs it to a ring buffer so the agent can read "what was that toast?" even after it's gone.

8. describe_v2() -- live introspection

Full v2 manifest snapshot. Includes every primitive registered on this page. The agent IA reads this to understand the UI tree.