Conversation
`accessibilityWindow` and `accessibilityTopLevelUIElement` returned the host view's `accessibilityParent`. That is the window only when the view is the window's content view. When the view is nested, for example as the document view of an NSScrollView or inside an NSSplitView, AppKit reports the nearest accessible ancestor instead, so assistive technologies were given a non-window object as the node's window and top-level element. Both selectors now return the live view's `window()`, or nil when the view is detached or gone. The accessibility parent of the root node is unchanged. A `harness = false` integration test covers a content view, a view nested in a scroll view, a detached view and a view moved to another window; it fails on the nested case without this change. Co-Authored-By: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On macOS,
AccessKitNodeanswersaccessibilityWindowandaccessibilityTopLevelUIElementwith the host view'saccessibilityParent. That object is the window only when the host view is the window's content view.Apps that host their AccessKit view inside other AppKit views get a different object. Examples are the document view of an
NSScrollView, or a pane of anNSSplitViewnext to a native sidebar. AppKit then reports the nearest accessible ancestor, such as the scroll area or split group. Assistive technologies receive that ancestor as the node's window and top-level element. VoiceOver and the Accessibility Inspector then attribute nodes to the wrong element and can fail to associate them with their window.We hit this in a GPUI-based editor whose render view is reparented into a split view with a native outline sidebar.
Change
window(), upcast toAnyObject. They returnnilwhen the view is detached or has been released.accessibilityParentis unchanged, so the element hierarchy still runs through the real ancestor views.Test
adapters/macos/tests/window_ownership.rsis aharness = falseintegration test. AppKit objects must be created on the main thread, which the default harness does not provide. The test checks both selectors on the root and on a child node in four states:nil.The test creates windows but never orders them front.
All pass locally on macOS 26.6 with Apple Silicon.
🤖 Generated with Claude Code