Skip to content

fix(a11y): Skip hidden or detached adds in the WASM semantic tree (backport #24383) - #25759

Merged
agneszitte merged 3 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24383
Oct 27, 2026
Merged

agneszitte merged 3 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24383

Conversation

@mergify

@mergify mergify Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

GitHub Issue: closes #

PR Type:

🐞 Bugfix

What changed? 🚀

On Skia for WebAssembly, the accessibility bridge emitted semantic DOM nodes for controls that should not be in the tree, and those nodes carried zero geometry:

  • UIElement.AddChild raises the accessibility hook even while the subtree is still being constructed (generated XAML builds bottom-up, before the page is attached). WebAssemblyAccessibility.OnChildAdded emitted such children against the semantic root because no live ancestor could be resolved, and nothing re-parented or pruned them once the subtree attached under a Collapsed ancestor.
  • The same happened for a child added to a live parent that already sits under a Collapsed ancestor: the pruning check only inspected the child's own Visibility.

Both produced root-level 0x0 nodes (a 16x6 <button> in Chromium) for controls that are not rendered, which is what an automation or assistive-technology client then reads.

OnChildAdded now skips adds whose parent is not in the live tree and outermost adds beneath a Collapsed ancestor; the attach of the subtree root, or the ancestor being shown (pruned-handle re-emit / Visibility re-add), replays the descendants through the existing recursion. Skipped adds are Trace-logged. This mirrors the guard the macOS host already carries and the router-side drop on Skia desktop.

Visible controls were already positioned correctly; the new geometry tests pin that as a regression guard.

Behavior change

Controls hosted under a Collapsed ancestor no longer appear in the Skia-WASM accessibility tree while hidden. This is WinUI parity (Collapsed subtrees are absent from UIA) and only removes phantom zero-size nodes, but a client that relied on finding a hidden control by aria-label will now get "not found" instead of a 0x0 node.

Tests

Skia-WASM, DOM-level, Given_AccessibleGeometry: node rect matches XAML bounds for a live add and for a detached-then-attached subtree; a detached-built control lands under its named group's node; no node under a Collapsed ancestor for both orderings, and the node appears with correct bounds once the ancestor is shown. Shared helpers added to WasmSemanticDomHelper (EnsureAccessibilityEnabledAsync, GetSemanticElementRect, GetSemanticParentId).

Runtime validation (Skia-WASM, headless Edge): unfixed build 2 pass / 2 fail on the original four tests; live-tree guard alone leaves the live-Collapsed-ancestor test failing; full fix 5/5; whole Windows_UI_Xaml_Automation namespace 213 pass / 0 fail / 19 platform skips.

Not yet measured

  • Skia desktop hosts are not touched by this change (Win32 goes through AccessibilityRouter, macOS already has the equivalent guard), so they were not re-run.
  • No perf measurement; the guard is a bool read plus, for outermost adds only, an ancestor walk that replaces a JS interop call and dictionary insert per skipped element.

PR Checklist ✅


This is an automatic backport of pull request #24383 done by [Mergify](https://mergify.com).

@agneszitte
agneszitte merged commit 84cda1c into release/stable/6.7 Oct 27, 2026
10 of 11 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.7/pr-24383 branch October 27, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants