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.
When a view removes a child that has an exit transition (the default), the DOM accessibility mirror goes wrong until the next layout commit:
- A pressable parent with a later pressable sibling drops out of the mirror. Assistive technology has nothing to activate.
- A pressable parent with no later pressable sibling stays a button, but the text of every node after it is read into its name, and those nodes are left out of the mirror.
The native AccessKit tree is right throughout. Then the exit ends without a commit, so the web shell never re-exports the mirror. The broken mirror stays in the DOM until something else commits, scrolls or resizes.
A common case is a tab bar where the selected tab holds an indicator. Selecting another tab removes the old indicator, and the tab that was just left vanishes from the mirror.
Repro (headless tests; serde_json is a dev-dependency):
use rune::{Cx, El, Env, Runtime, col, el, row, text};
fn names<S: 'static>(rt: &Runtime<S>) -> Vec<String> {
let v: serde_json::Value = serde_json::from_str(&rt.a11y_json()).unwrap();
v.as_array().unwrap().iter()
.map(|i| format!("{} {}", i["k"].as_str().unwrap(), i["t"].as_str().unwrap_or("")))
.collect()
}
// Two tabs; the selected one holds an indicator, which exits when the other is selected.
fn tabs(sel: &usize, _: &mut Cx<usize>) -> El {
let tab = |i: usize| {
let t = row().key(format!("tab-{i}")).role("tab").label(format!("Tab {i}")).size(80.0, 30.0)
.on_press(move |s: &mut usize| *s = i)
.child(text(format!("Tab {i}")).a11y_hidden());
if *sel == i { t.child(el().key("marker").size(80.0, 3.0)) } else { t }
};
col().size(400.0, 400.0).child(row().key("tabs").child(tab(0)).child(tab(1)))
}
#[test]
fn exiting_child_drops_its_parent() {
let mut rt = Runtime::new(0, tabs, (400.0, 400.0), Env::new(true, 1.0));
rt.frame(0.0);
assert_eq!(names(&rt), ["button Tab 0", "button Tab 1"]);
let (x, y) = rt.find("tab-1").unwrap();
rt.pointer_down(x, y); rt.pointer_up(x, y); rt.frame(0.0);
let commits = rt.stats.commits;
// The exiting marker is listed last, after tab-1, not under tab-0.
let paths: Vec<String> = rt.elements().into_iter().map(|e| e.path).collect();
assert_eq!(paths.last().map(String::as_str), Some("#0/tabs/tab-0/marker"));
assert_eq!(names(&rt), ["button Tab 1"]); // Tab 0 is gone
assert!(rt.accessibility_json().to_string().contains("\"Tab 0\"")); // native has it
for _ in 0..60 { rt.frame(1.0 / 60.0); }
assert_eq!(names(&rt), ["button Tab 0", "button Tab 1"]); // a11y_json() is right again...
assert_eq!(rt.stats.commits, commits); // ...but nothing committed
}
// A button with a badge that goes away on press, then a paragraph.
fn note(badge: &bool, _: &mut Cx<bool>) -> El {
let mut b = row().key("save").role("button").size(80.0, 30.0)
.on_press(|s: &mut bool| *s = false).child(text("Save"));
if *badge { b = b.child(el().key("badge").size(6.0, 6.0)); }
col().size(400.0, 400.0).child(b).child(text("Last saved at noon").key("note"))
}
#[test]
fn exiting_child_pulls_later_siblings_into_its_parent() {
let mut rt = Runtime::new(true, note, (400.0, 400.0), Env::new(true, 1.0));
rt.frame(0.0);
assert_eq!(names(&rt), ["button Save", "text Last saved at noon"]);
let (x, y) = rt.find("save").unwrap();
rt.pointer_down(x, y); rt.pointer_up(x, y); rt.frame(0.0);
assert_eq!(names(&rt), ["button Save Last saved at noon"]);
}Both tests pass at 29aacb6. In a frame-by-frame probe at 1/60 s, Tab 0 was missing from a11y_json() for about 15 to 20 frames. The web shell keeps the last export, so in the browser it stays missing until the next commit.
Expected:
- While the marker exits, the mirror is
["button Tab 0", "button Tab 1"]. While the badge exits, it is["button Save", "text Last saved at noon"]. - The exiting node itself is left out, as it is now.
- When the exit ends, the shell re-exports the mirror if it changed.
Actual: the mirrors above. In the browser they last until something else commits, because the shell never re-exports when the exit ends.
Where:
- Removed nodes that are still exiting are pushed after every present node (
runtime/commit/apply.rs:699-700,805-806). While a child exits, its parent's subtree is no longer contiguous innodes. subtree_ends(runtime/web/a11y.rs:247-256) takes each node's end as the largest end among its children (ends[p] = ends[p].max(ends[i])). Its doc says this matchessubtree_end, but that holds only for contiguous subtrees. An exiting child at the tail stretches its parent's end, and every ancestor's, to the end ofnodes.subtree_end(a11y.rs:235-245) stops at the first node that is not a descendant, so it still gives the right range.- With the stretched range:
nested_press(a11y.rs:393) finds the later sibling'son_press, so the tab is not collapsed into a button. It has no other item kind, so it emits nothing (the first test).- With no later pressable, the parent does collapse.
descendant_label(i, end)(a11y.rs:395) reads the later siblings' text into its name, andi = end(a11y.rs:401) skips them (the second test).
- When the exit settles,
prune_exited(runtime/frame.rs:698-700,runtime/commit/prune.rs:6) removes the node without a commit. The only increment is inapply.rs:53.web_a11y(a11y.rs:503-520) rebuilds only when the commit count, viewport or scroll digest changed, sosync_input(platform/web/input.rs:98-100) getsNoneand the DOM keeps the broken mirror.
Pressing works once the element is back: web_a11y_action (a11y.rs:522-531) resolves the path with live. While the element is missing, assistive technology has nothing to press.
Suggested direction:
- Give
subtree_endsthe same answer assubtree_end, ending a range at the first node that is not a descendant. Alternatively, leave nodes past the present length out of their ancestors' ranges. - Make a prune count for the mirror's gate, for example with a generation that
prune_exitedbumps, so the mirror is rebuilt once when the exit ends.
Activity
brittianwarner commentedon Nov 11, 2026
A second trigger for the same cause, at the same rev (
29aacb688883a9712bc27175bdafd99fc6edb421): a key change on a child behaves like a removal.Shape: a header holds a menu button whose icon child is keyed
chevron-downorchevron-updepending on whether its menu is open. After the header comemainand anavwith tab buttons.What happens when the menu closes:
Runtime::nodes.subtree_endsassumes preorder, so the menu button's range now runs over every later node.nested_presssees the nav's buttons inside that range, so the menu button is no longer collapsed into one mirror button and drops out ofa11y_json().mainandnavcome out with the header as their parent.Effect: pressing Escape in the menu has no mirror element to return focus to, so keyboard focus lands on the document body.
Expected: a child whose key changes leaves its parent's range and its siblings' parents as they were, and the mirror keeps the button while the old child exits.
Workarounds we carry: for tabs, every tab keeps a stable keyed child, so a selection change exits nothing. For the menu button, our own accessibility layer draws a stand-in for the button while the mirror lacks it and asks for redraws until the mirror is whole.
Hona commentedon Nov 23, 2026
Fixed on
devin #1219 and #914:subtree_endsnow ends live subtrees before exiting or unmounted nodes so an exiting child (from removal or a key change) can no longer stretch its parent's range over later siblings, andweb_a11ytracksanimatingso the DOM mirror rebuilds once the exit finishes.Closing as completed. If you still see this on a current dev revision, comment here and it will be reopened.