From 295b1881936dd097d82a10317ff14d1369f7e4bd Mon Sep 17 00:00:00 2001 From: HolgerGottChristensen Date: Mon, 21 Oct 2024 14:15:12 +0200 Subject: [PATCH] fix: Add properties needed by the Xcode Accessibility Inspector (#466) --- platforms/macos/src/node.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/platforms/macos/src/node.rs b/platforms/macos/src/node.rs index 76fa16551..bbf117c27 100644 --- a/platforms/macos/src/node.rs +++ b/platforms/macos/src/node.rs @@ -347,6 +347,28 @@ declare_class!( .flatten() } + #[method_id(accessibilityWindow)] + fn window(&self) -> Option> { + self.resolve_with_context(|_, context| { + context + .view + .load() + .and_then(|view| unsafe { NSAccessibility::accessibilityParent(&*view) }) + }) + .flatten() + } + + #[method_id(accessibilityTopLevelUIElement)] + fn top_level(&self) -> Option> { + self.resolve_with_context(|_, context| { + context + .view + .load() + .and_then(|view| unsafe { NSAccessibility::accessibilityParent(&*view) }) + }) + .flatten() + } + #[method_id(accessibilityChildren)] fn children(&self) -> Option>> { self.children_internal() @@ -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)