Skip to content

Commit

Permalink
fix: Add properties needed by the Xcode Accessibility Inspector (#466)
Browse files Browse the repository at this point in the history
  • Loading branch information
HolgerGottChristensen authored Oct 21, 2024
1 parent cf33013 commit 295b188
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions platforms/macos/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,28 @@ declare_class!(
.flatten()
}

#[method_id(accessibilityWindow)]
fn window(&self) -> Option<Id<AnyObject>> {
self.resolve_with_context(|_, context| {
context
.view
.load()
.and_then(|view| unsafe { NSAccessibility::accessibilityParent(&*view) })
})
.flatten()
}

#[method_id(accessibilityTopLevelUIElement)]
fn top_level(&self) -> Option<Id<AnyObject>> {
self.resolve_with_context(|_, context| {
context
.view
.load()
.and_then(|view| unsafe { NSAccessibility::accessibilityParent(&*view) })
})
.flatten()
}

#[method_id(accessibilityChildren)]
fn children(&self) -> Option<Id<NSArray<PlatformNode>>> {
self.children_internal()
Expand Down Expand Up @@ -784,6 +806,8 @@ declare_class!(
|| selector == sel!(accessibilityChildrenInNavigationOrder)
|| selector == sel!(accessibilityFrame)
|| selector == sel!(accessibilityRole)
|| selector == sel!(accessibilityWindow)
|| selector == sel!(accessibilityTopLevelUIElement)
|| selector == sel!(accessibilityRoleDescription)
|| selector == sel!(accessibilityIdentifier)
|| selector == sel!(accessibilityTitle)
Expand Down

0 comments on commit 295b188

Please sign in to comment.