Repository navigation
Description
Current behavior 🐛
On the Skia macOS host, an element added to the visual tree after the accessibility tree is built, under a parent whose AutomationProperties.AccessibilityView is Raw, replaces the window's accessibility root. VoiceOver and Accessibility Inspector are then left with one stray element (for example a 1×1 template part); every other control in the window disappears from the tree.
Cause, as of 7.0.65:
MacOSAccessibility.OnChildAdded(parent, child, index)skips aRawchild and recurses into its children, but it does not check whether the parent isRaw. It callsAddAccessibilityElement(parent.Visual.Handle, child, index)with the handle of theRawparent, which was never registered with the native side (BuildAccessibilityTreeRecursiveattaches aRawelement's children to the nearest registered ancestor instead).uno_accessibility_add_element(UNOAccessibility.m) does not find that parent handle, soparentisniland it takes theelsebranch:context.rootElement = element;. The new child becomes the root of the window's tree.
Any template that builds Raw parts on first layout triggers it on pages shown after the first one: a TextBox's ContentElement scroll viewer, a ScrollBar thumb, a ToggleSwitch thumb, a TextBox marked Raw by the app. In a Debug build with UseStudio(), Hot Design's elements do the same at launch, so the tree is empty from the start.
Expected behavior 🎯
A child added under a Raw parent attaches to the nearest registered ancestor, as it does during the initial build, and the native side never replaces the root with an element whose parent handle it does not know (log and drop, or attach to the window's root instead).
How to reproduce it (as minimally and precisely as possible)
Seen in a Skia app whose later pages host a canvas-drawn control with a hidden Raw TextBox child, and pages with ScrollBars and ToggleSwitches. These are the minimal steps that follow from the code above (not yet tried as a standalone repro):
- Uno.Sdk 7.0.22 (Uno.WinUI 7.0.65),
net10.0-desktop, macOS, Release build. - A window with a
Frameand two pages. The second page contains aButtonand aTextBoxwithAutomationProperties.AccessibilityView="Raw"(or anyScrollBar). - Turn VoiceOver on, launch, navigate to the second page.
- VoiceOver (or Accessibility Inspector) shows a single element: the
TextBoxtemplate part (or the thumb). TheButtonand the rest of the window are gone. Navigating back does not restore them.
The first page shown at launch is exposed correctly.
Workaround 🛠️
None found in app code. Applying the templates earlier does not help: the template parts are still added once the element is in the window.
Works on UWP/WinUI 🤷
Yes
Affected platforms 📱💻🖥️
Skia (macOS)
Uno.Sdk version (and other relevant versions) 📦
Uno.Sdk 7.0.22 / Uno.WinUI 7.0.65 (first seen on 6.7.135), .NET 10, macOS 26.
Anything else we need to know? 💬
Possibly related: #25228 (a closed context flyout removes the control from the macOS tree) and #24669.
Activity