Skip to content

Add retained web accessibility and Text view - #59

Closed
dutch-casa wants to merge 33 commits into
anomalyco:devfrom
dutch-casa:web-accessibility
Closed

dutch-casa wants to merge 33 commits into
anomalyco:devfrom
dutch-casa:web-accessibility

Conversation

@dutch-casa

Copy link
Copy Markdown

What changes

This adds a retained semantic DOM mirror beside the web canvas so browser accessibility tools and Find-in-page can read Rune content. It reuses Rune's current focus, modal admission, actions and editing protocol rather than maintaining a second application tree.

  • Expose control names, descriptions, states, values, relationships and keyboard cursors from Rune and Rune Kit.
  • Preserve native editor identity, composition and read-only selection across scene updates and virtual-row unmounts.
  • Add an optional Text view using the same semantic DOM for native text selection, browser text customization and reflow.
  • Fix shared disabled-subtree admission, inline-link focus order and modal focus restoration. Update Kit control semantics and keyboard behavior.
  • Add browser fixtures, regression coverage, documentation and changelog entries.

The branch includes current upstream dev without rewriting its existing commits.

Verification

Verified on macOS with Rust 1.99.0, wasm-bindgen 0.2.129 and Chromium:

  • cargo check --workspace --all-targets
  • cargo test -p rune -p rune-kit --features rune-kit/markdown
  • scripts/web-build.sh web-hello --out target/web-pr (release artifact; installed LLD selected for this local toolchain)
  • node scripts/web-focus.mjs
  • node scripts/web-smoke.mjs target/web-pr target/web-pr-proof
  • scripts/file-size.sh (passes with existing size warnings)
  • git diff --check

The browser run covers WebGPU rendering, idle frames, editing/composition, clipboard, touch and pinch zoom, native accessibility metadata, Kit interactions, and Text view reflow. Also inspected canvas/Text view rendering and exercised disclosure, Text view actions and table sorting in Chromium.

Limits

This does not add native AccessKit adapters or certify WCAG conformance. Virtual lists expose mounted rows. Physical mobile IME, real-device touch and Safari/VoiceOver were not verified in this run. Applications still own content alternatives, contrast and custom control behavior.

dutch-casa and others added 30 commits October 31, 2026 14:11
Exclude disabled descendants from hit testing and keyboard focus, admit read-only editor focus without edit authority, and keep source-ordered link identity across modal restoration.

Extend upstream's existing browser projector with retained native editors, control names and state, and help descriptions. Use clipped semantic content, keep focus off the aria-hidden canvas, and preserve IME identity and current input admission.

Exercise the browser accessibility tree with actual Rune Kit controls. Keep export tooling and native-paste expansion separate, document the shared desktop behavior, and leave native accessibility adapters and certification out of scope.
Link Field controls to their retained caption nodes, remove duplicate sequential link stops, and preserve option and tab content names. Native pinch zoom remains available while Rune handles one-finger scrolling.

Keep readonly Return, selection and copy on the non-editing path and deny native IME activation. Regression checks reproduced each defect before the correction; focusable pressable naming passed and its implementation is unchanged.

Document disabled input admission and keep the changelog to one entry. Static export and native-paste expansion remain separate.
Project range values, invalid state, control relationships and keyboard cursors from the retained scene. Reuse Kit state and keyboard owners for disclosures, menus, tables, trees and pane resizing. Keep standalone header toggles independent of selection-following rows.

Use the existing semantic DOM for optional browser text presentation. Preserve editor identity and document selection through reconciliation. Keep Safari native activation and changing control names observable without changing the renderer or menu motion.

Exercise browser input, captions, keyboard behavior, reflow, user text styles and clipboard operations. Document author responsibilities and the limits of the verified browser and screen-reader paths.
Memo children flatten through flatten_ref, which kept the child's own accessibility state, and a reused memo kept that slice when only an ancestor's disabled flag changed. Disabled is now a hot flag beside inert, inherited on both flatten paths and part of the memo's inherited state, so the closure is not rebuilt when an ancestor toggles it. A click on the disabled subtree reaches whatever is drawn behind it.

Co-authored-by: Dutch Casadaban <[email protected]>
ElementInfo: :inert followed input admission, so a disabled control was reported inert. Inert now means the element is outside the accessibility tree: an inert subtree, content behind the active modal, or an element that is leaving.
Co-authored-by: Dutch Casadaban <[email protected]>
The mounted window already refused input, but the offscreen selection walk only inherited inert. A disabled list, and a disabled row inside one, now stay out of that walk.

Co-authored-by: Dutch Casadaban <[email protected]>
Return on a focused combobox followed the wasm target, so host tests could only see one side of the rule. The web shell now sets that policy, and other hosts leave Return with the window's default button.

Co-authored-by: Dutch Casadaban <[email protected]>
The name, collapse and relationship pass lives in one tree. The web mirror
projects it, and the inspector reports the same computed name.

A pressable that contains another pressable, a link or a slider keeps each
node, so every Rust tab stop has a DOM node. aria-selected is set only for an
item in a selection, including an unselected one, and a multi-select grid says
so. A virtual row reports its place in the full set. A heading with no level
is level 2. Text keyed flow- stays separate nodes. a11y_json names every field
with a word, and checked is an object. El::pressed and El::current set
aria-pressed and aria-current. A paint-only change does not reserialize the
tree.

Co-authored-by: Dutch Casadaban <[email protected]>
@SuperManfred

Copy link
Copy Markdown

Thanks for this. It's a welcome step for the web target, and it's the reason we'd like to help: we probably wouldn't have taken this on otherwise, but since the effort is already under way, it seems worth going the extra mile to WCAG 2.1 Level AA. WCAG is the standard that most web accessibility laws and procurement rules point to (57 of the 83 in W3C's list), so an app built on Rune's web target could actually make a conformance claim.

Since this PR opened, dev has added AccessKit (e58b87c) with its own tree and El builders that overlap the ones here (value_range/range_value, indeterminate/checked_mixed, sort/sorted, key_shortcuts/shortcut_hint), and the branch now conflicts with dev in 39 files. The web is still outside that tree.

Would you take web support that projects the crate::a11y tree into this PR's DOM mirror (native editors, Text view, live regions) instead of a second semantic tree? We have WCAG 2.1 A and AA browser checks running in Chromium and WebKit, and a few fixes we'd bring along:

  • the password field exposes no value to screen readers, and autofill appends to what was typed instead of replacing it;
  • autocomplete and lang on El (input purpose, language of parts);
  • Kit text fields overflow and are clipped at 200% zoom on a phone-width window;
  • a contrast audit a theme can run in a test.

Happy to do the port if that's the direction you want.

@SuperManfred

SuperManfred commented Nov 5, 2026 •

Copy link
Copy Markdown

@kitlangton @Hona, since this would build on the AccessKit tree from e58b87c, your view on the direction above would help before anyone ports it.

Oh and when I say “we” above, we really mean me and opium 5.5 🫠

@thdxr

thdxr commented Nov 6, 2026

Copy link
Copy Markdown
Member

thanks for this. rune is agent-driven, so we don't take pull requests. if you'd like a change or a bug fixed, have your agent open an issue describing it (https://github.com/anomalyco/rune/issues) and our agents will pick it up.

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.

4 participants