Skip to content

Commit 295b188

Browse files
fix: Add properties needed by the Xcode Accessibility Inspector (#466)
1 parent cf33013 commit 295b188

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

platforms/macos/src/node.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,28 @@ declare_class!(
347347
.flatten()
348348
}
349349

350+
#[method_id(accessibilityWindow)]
351+
fn window(&self) -> Option<Id<AnyObject>> {
352+
self.resolve_with_context(|_, context| {
353+
context
354+
.view
355+
.load()
356+
.and_then(|view| unsafe { NSAccessibility::accessibilityParent(&*view) })
357+
})
358+
.flatten()
359+
}
360+
361+
#[method_id(accessibilityTopLevelUIElement)]
362+
fn top_level(&self) -> Option<Id<AnyObject>> {
363+
self.resolve_with_context(|_, context| {
364+
context
365+
.view
366+
.load()
367+
.and_then(|view| unsafe { NSAccessibility::accessibilityParent(&*view) })
368+
})
369+
.flatten()
370+
}
371+
350372
#[method_id(accessibilityChildren)]
351373
fn children(&self) -> Option<Id<NSArray<PlatformNode>>> {
352374
self.children_internal()
@@ -784,6 +806,8 @@ declare_class!(
784806
|| selector == sel!(accessibilityChildrenInNavigationOrder)
785807
|| selector == sel!(accessibilityFrame)
786808
|| selector == sel!(accessibilityRole)
809+
|| selector == sel!(accessibilityWindow)
810+
|| selector == sel!(accessibilityTopLevelUIElement)
787811
|| selector == sel!(accessibilityRoleDescription)
788812
|| selector == sel!(accessibilityIdentifier)
789813
|| selector == sel!(accessibilityTitle)

0 commit comments

Comments
 (0)