Repository navigation
fix(a11y): Skip hidden or detached adds in the WASM semantic tree - #24383
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The PR description is missing a valid GitHub issue link (it currently says closes #) and must be updated to meet the repo’s mandatory issue-linking format.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes Skia-WASM accessibility-tree correctness by preventing semantic DOM nodes from being emitted for elements that are either (a) added while their subtree is still detached or (b) added under a Visibility.Collapsed ancestor—both of which previously produced “phantom” root-level nodes with zero geometry.
Changes:
- Added an early-return guard in
WebAssemblyAccessibility.OnChildAddedto skip detached and collapsed-ancestor adds, plus a helper to detect collapsed ancestry. - Added new Skia-WASM DOM-level runtime tests (
Given_AccessibleGeometry) to pin correct semantic-node placement, parenting, and collapsed-subtree pruning behavior. - Expanded
WasmSemanticDomHelperwith shared helpers for enabling accessibility, querying semantic-node rects, and parent DOM ids; updated the remediation tasks spec with the follow-up note.
Note: The PR description currently includes **GitHub Issue:** closes # (blank). This repo requires either a real issue link or an explicit “no public issue” note in the required format.
File summaries
| File | Description |
|---|---|
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Automation/WasmSemanticDomHelper.cs | Adds shared DOM-query helpers and an async “ensure a11y enabled” helper to stabilize dynamic-path semantic DOM tests. |
| src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Automation/Given_AccessibleGeometry.cs | New Skia-WASM runtime tests validating semantic DOM geometry/parenting and collapsed-subtree absence until shown. |
| src/Uno.UI.Runtime.Skia.WebAssembly.Browser/Accessibility/WebAssemblyAccessibility.cs | Skips OnChildAdded processing for detached parents and outermost adds under collapsed ancestors; adds collapsed-ancestor detection helper. |
| specs/003-wasm-a11y-remediation/tasks.md | Updates task T058 with the runtime-found ordering edge case and test coverage note. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-24383/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-24383/docs/index.html |
|
The build 231933 found UI Test snapshots differences: Details
|
|
|
|
@Mergifyio backport servicing/6.8 |
✅ Backports have been createdDetails
|
morning4coffe-dev
left a comment
There was a problem hiding this comment.
Skipping detached additions and pruning beneath a collapsed ancestor is consistent with WinUI's ChildIsAcceptable visibility gate and recursive child walk. The change does not equate offscreen/zero-size/transparent content with Collapsed. Existing subtree attach and pruned-handle reveal paths supply the deferred emission, and the new cases exercise both ordering variants, geometry and semantic parenting. No blocking source-level discrepancy found.
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
…r-24383 fix(a11y): Skip hidden or detached adds in the WASM semantic tree (backport #24383)
|
@Mergifyio backport release/stable/6.7 |
✅ Backports have been createdDetails
|
…6.7/pr-24383 fix(a11y): Skip hidden or detached adds in the WASM semantic tree (backport #24383)
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.AddChildraises the accessibility hook even while the subtree is still being constructed (generated XAML builds bottom-up, before the page is attached).WebAssemblyAccessibility.OnChildAddedemitted 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 aCollapsedancestor.Collapsedancestor: the pruning check only inspected the child's ownVisibility.Both produced root-level
0x0nodes (a16x6<button>in Chromium) for controls that are not rendered, which is what an automation or assistive-technology client then reads.OnChildAddednow 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
Collapsedancestor 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 byaria-labelwill now get "not found" instead of a0x0node.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 toWasmSemanticDomHelper(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_Automationnamespace 213 pass / 0 fail / 19 platform skips.Not yet measured
AccessibilityRouter, macOS already has the equivalent guard), so they were not re-run.PR Checklist ✅
Screenshots Compare Test Runresults.