Skip to content

fix(web): mirror tablist containers and closable tabs with sibling close buttons - #1583

Merged
Hona merged 1 commit into
devfrom
fix/1344-web-a11y-tablist-closable-tabs
Nov 23, 2026
Merged

Hona merged 1 commit into
devfrom
fix/1344-web-a11y-tablist-closable-tabs

Conversation

@Hona

@Hona Hona commented Nov 23, 2026

Copy link
Copy Markdown
Member

Fixes #1344

Root cause

  • crates/rune/src/a11y/roles.rs: tablist was registered without .aria_container(), so roles::container_tag("tablist") returned None and RuntimeCore::web_a11y_items omitted the tablist container.
  • crates/rune/src/runtime/web/a11y.rs: web_a11y_items skipped any button_like element when nested_press was true, dropping closable tabs (role="tab") because their descendant close button has on_press / role="button".

Changes

  • crates/rune/src/a11y/roles.rs: mark tablist with .aria_container() so it mirrors as a <div role="tablist"> container.
  • crates/rune/src/runtime/web/a11y.rs:
    • Emit button_like nodes that carry an explicit roles::web_control_role even when nested_press is true.
    • When nested_press is true, advance i += 1 while tracking control_end so nested interactive descendants (such as a tab's close button) mirror as sibling <button> elements under the enclosing tablist without duplicating the control's own non-interactive text.
    • Skip a11y.hidden, invisible, and nested pressable subtrees in descendant_label so a control without an explicit label does not absorb a nested button's name.
  • crates/rune/src/runtime/web/a11y_tests.rs and crates/rune-kit/src/shell/tab_strip/tests.rs: add regression tests for tablist, closable tabs, selected state, sibling close buttons, and a11y_press activation.
  • changelog/unreleased/2026-11-23-web-a11y-tablist-closable-tabs.md: changelog entry.

Verification

  • Confirmed both new tests fail without the fix and pass with it:
    • cargo test -p rune -p rune-mermaid -p rune-kit --features rune-kit/markdown,rune-kit/mermaid -- runtime::web:: a11y::roles shell::tab_strip (43 passed in rune, 3 passed in rune-kit)
    • cargo test -p rune -p rune-kit --features rune-kit/markdown,rune-kit/mermaid -- a11y (40 passed, 1 ignored in rune; 1 passed in rune-kit)
  • cargo check -p rune --no-default-features --target wasm32-unknown-unknown (passed)
  • scripts/file-size.sh (passed)
  • Not checked on this machine: live browser DOM inspection via bridge.js (verified via Runtime::a11y_json() and Runtime::web_a11y_items() unit tests and wasm32 compilation).

@Hona
Hona merged commit 9c915fe into dev Nov 23, 2026
1 check passed
@Hona
Hona deleted the fix/1344-web-a11y-tablist-closable-tabs branch November 23, 2026 06:58
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 accessibility mirror omits closable TabStrip tabs and the tablist container

1 participant