Skip to content

feat(web): mirror ARIA container roles, disabled/busy states, and range controls - #1965

Merged
Hona merged 1 commit into
devfrom
feat/118-web-a11y-mirror
Nov 24, 2026
Merged

Hona merged 1 commit into
devfrom
feat/118-web-a11y-mirror

Conversation

@Hona

@Hona Hona commented Nov 24, 2026

Copy link
Copy Markdown
Member

Fixes #118

Extends the existing web DOM accessibility mirror (A11yMirror, web_a11y_items, web_a11y_focus, and bridge.js) to match WAI-ARIA 1.2 role/state semantics and Rune's native AccessKit tree (crates/rune/src/a11y/node.rs) without changing DOM focus routing, Find-in-page, or incremental patch identity.

What changed

  • ARIA container roles (crates/rune/src/a11y/roles.rs, crates/rune/src/runtime/web/a11y.rs):
    • Marked menu, menubar, tree, treegrid, tabpanel, toolbar, grid, gridcell, rowgroup, form, and search as .aria_container() (div[role] with aria-label), preserving hierarchy for menus, trees, tab panels, toolbars, and grids.
    • Leaf text nodes with an ARIA container role (such as text("OK").role("gridcell")) project as <p role="..."> so text is not dropped.
  • Disabled and busy states (crates/rune/src/runtime/web/a11y.rs, crates/rune/src/runtime/web/a11y/patch.rs, crates/rune/src/platform/web/bridge.js):
    • Added disabled ("dis": true) and busy ("b": true) to A11yItem, SentItem, and web_focus_item.
    • Applied aria-disabled="true" (without setting HTML disabled, keeping disabled controls discoverable as in AccessKit and WAI-ARIA 1.2) and aria-busy="true" on both mirror elements and the canvas aria-activedescendant focus proxy.
    • Mirrored stateful and disabled web_control_role elements (menuitem, menuitemcheckbox, menuitemradio, tab, checkbox, radio, switch, option, treeitem) even when they carry no on_press handler, and rejected a11y_press / a11y_link on disabled or disallowed nodes in both bridge.js and RuntimeCore::web_a11y_action.
    • Mirrored aria-level and aria-expanded on treeitem controls and expandable container rows (such as treegrid rows).
  • Range controls (slider / spinbutton) (crates/rune/src/a11y/roles.rs, crates/rune/src/runtime/web/a11y.rs, crates/rune/src/platform/web/bridge.js):
    • Marked slider and spinbutton as .web_control() and exported rg (aria-valuemin / aria-valuemax / aria-valuenow) and vt (aria-valuetext) in the mirror and rg in web_focus_item, omitting range/value on secure nodes and non-finite ranges.
    • Named slider and spinbutton via aria-label with empty textContent (matching WAI-ARIA 1.2 nameFrom: author).
  • Examples & docs:
    • examples/web-hello: gave the header role("toolbar") and Send disabled state when the draft is empty, plus an interactive ?a11y-proof scene exercising all added roles, states, range controls, and focus proxy updates.
    • examples/web-showcase: added formatted a11y_value percentage text to the Puck slider so it exposes aria-valuetext alongside aria-valuemin/aria-valuemax/aria-valuenow.
    • Updated WEB.md, crates/rune/README.md, and added a changelog entry in changelog/unreleased/.

Outside answer

  • WAI-ARIA 1.2 container roles, aria-disabled / aria-busy, aria-level, slider / spinbutton nameFrom: author and aria-valuemin/max/now/text, aligned with Rune's native AccessKit mapping in crates/rune/src/a11y/node.rs.

Verification

  • Windows: cargo test -p rune --lib a11y (105 passed), cargo test -p rune --lib runtime::web (68 passed), cargo test -p rune-kit --features markdown,mermaid --test a11y (42 passed), cargo check-wasm, cargo check-webgl, cargo check -p web-hello -p web-showcase --target wasm32-unknown-unknown, node --test crates/rune/src/platform/web/bridge.test.mjs (45 passed), scripts/file-size.sh.
  • macOS: cargo test -p rune --lib runtime::web (68 passed).
  • Headless Chromium (software WebGL2/WebGPU via ANGLE/Vulkan SwiftShader): smoke checks for web-hello, web-showcase, and fetch on both WebGPU and WebGL2, plus a dedicated ?a11y-proof scenario (0/15 on dev, 15/15 on this branch) verifying DOM mirror roles, aria-disabled without HTML disabled, aria-busy, treeitem with sibling Preview button, slider/spinbutton range attributes, and canvas aria-activedescendant focus proxy updates.
  • Not verified: live screen readers (VoiceOver, NVDA, JAWS, Orca), Safari/Firefox, real GPU drivers, real touch screens, and KHR_parallel_shader_compile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web: render the AccessKit tree into the DOM accessibility mirror (roles, states, live regions, focus)

1 participant