Repository navigation
Description
Rev: 29aacb6 (29aacb688883a9712bc27175bdafd99fc6edb421). The code below is unchanged on dev c92e462 (2026-11-11).
Target: the web shell, app mode and page mode. The mirror is built in runtime/web/a11y.rs, which has no cfg, so Runtime::a11y_json() returns on native the JSON syncA11y renders. Reproduced headless on macOS (aarch64), Rust 1.99.1, default-features = false.
While any element with El::modal is open (a dialog, a sheet, an anchored menu), a11y_json() is []. The DOM mirror then holds nothing: neither the content behind the modal nor the modal's own controls.
The native AccessKit tree is right. It keeps the modal and the nodes that contain it, and drops only the content behind it.
On the web this means:
- A screen reader user who opens a dialog or menu finds an empty document.
- In
App::web_documentmode, the mirror's buttons are the page's Tab stops (bridge.js:320) and the browser owns Tab (platform/web/input.rs:235-237). So an open dialog has no Tab stop at all.
Repro (a headless test):
use rune::{Cx, El, Env, Runtime, col, row, text};
fn view(open: &bool, _: &mut Cx<bool>) -> El {
let mut root = col().size(400.0, 400.0)
.child(text("Settings").role("heading").level(1))
.child(row().key("delete").role("button").label("Delete").size(80.0, 30.0)
.on_press(|s: &mut bool| *s = true));
if *open {
root = root.child(col().key("confirm").role("dialog").label("Delete this item?").size(200.0, 100.0)
.modal(true, |s: &mut bool| *s = false)
.child(row().key("ok").role("button").label("Delete").size(60.0, 30.0).on_press(|s: &mut bool| *s = false))
.child(row().key("cancel").role("button").label("Cancel").size(60.0, 30.0).on_press(|s: &mut bool| *s = false)));
}
root
}
#[test]
fn open_modal_empties_the_web_mirror() {
let mut rt = Runtime::new(false, view, (400.0, 400.0), Env::new(true, 1.0));
rt.frame(0.0);
assert_ne!(rt.a11y_json(), "[]");
let (x, y) = rt.find("delete").unwrap();
rt.pointer_down(x, y); rt.pointer_up(x, y);
for _ in 0..60 { rt.frame(1.0 / 60.0); }
let native = rt.accessibility_json().to_string();
assert!(native.contains("\"dialog\"") && native.contains("\"Cancel\"")); // passes
assert_eq!(rt.a11y_json(), "[]"); // passes: nothing
}Expected: while the dialog is open, the mirror has the dialog's controls (button Delete and button Cancel, under #0/confirm), and the content behind the dialog is left out. This is what the native tree holds.
Actual: [].
Where:
refresh_modal_index(runtime/input/focus.rs:72-98) counts a node as a member only if it comes at or after the modal (i >= index, line 83), or is a caption button or an anchored portal (lines 86-96). The modal's ancestors, the root among them, come before it, so they are not members, andallowed(focus.rs:99-102) is false for them.web_a11y_itemschecks!self.allowed(i)first and skips the node's whole subtree on a miss (runtime/web/a11y.rs:324-327,i = end). The first node it sees is the root, whose subtree is every node, so the walk ends before it reaches the modal.- The native tree handles the same case.
holds_modal(a11y/tree.rs:309-320) marks every ancestor of a modal member. Thegonetest (tree.rs:332-333) keeps those ancestors and drops only what is behind the modal.
Suggested direction: in web_a11y_items, walk into an ancestor of a modal member without emitting it, as the native tree does with holds_modal. Only a node that is neither a member nor such an ancestor would skip its subtree. Exposing the modal as a dialog with aria-modal belongs to #118.
Activity
Hona commentedon Nov 23, 2026
Fixed on
devin #994:web_a11y_itemsnow descends through ancestors of an open modal (modal_ancestor) without emitting them instead of skipping the root subtree, so the modal's controls stay in the DOM mirror while background content is omitted.Closing as completed. If you still see this on a current dev revision, comment here and it will be reopened.