@@ -6,12 +6,11 @@ use accessibility::{AXAttribute, AXUIElement, AXUIElementAttributes};
66use accessibility_sys:: {
77 AXUIElementCopyMultipleAttributeValues , AXValueCreate , AXValueGetValue , AXValueRef ,
88 kAXButtonRole, kAXCellRole, kAXCheckBoxRole, kAXComboBoxRole, kAXContentListSubrole,
9- kAXErrorSuccess, kAXGroupRole, kAXHiddenAttribute, kAXImageRole, kAXListRole,
10- kAXMenuButtonRole, kAXMenuItemRole, kAXMenuRole, kAXPopUpButtonRole, kAXPositionAttribute,
11- kAXPressAction, kAXRoleAttribute, kAXRowRole, kAXScrollAreaRole, kAXScrollBarRole,
12- kAXSelectedTextRangeAttribute, kAXSizeAttribute, kAXStaticTextRole, kAXTextAreaRole,
13- kAXTextFieldRole, kAXTitleAttribute, kAXValueTypeCFRange, kAXValueTypeCGPoint,
14- kAXValueTypeCGSize, kAXWindowRole,
9+ kAXErrorSuccess, kAXGroupRole, kAXHiddenAttribute, kAXImageRole, kAXListRole, kAXMenuItemRole,
10+ kAXMenuRole, kAXPopUpButtonRole, kAXPositionAttribute, kAXPressAction, kAXRoleAttribute,
11+ kAXRowRole, kAXScrollAreaRole, kAXScrollBarRole, kAXSelectedTextRangeAttribute,
12+ kAXSizeAttribute, kAXStaticTextRole, kAXTextAreaRole, kAXTextFieldRole, kAXTitleAttribute,
13+ kAXValueTypeCFRange, kAXValueTypeCGPoint, kAXValueTypeCGSize, kAXWindowRole,
1514} ;
1615use core_foundation:: {
1716 array:: { CFArray , CFArrayRef } ,
@@ -35,7 +34,7 @@ pub enum ElementSignal {
3534 // Traversal
3635 ElementFound ( Option < ElementOfInterest > ) ,
3736 TraversalFinished ( Target ) ,
38- StartPopup ,
37+ StartPopup ( Frame ) ,
3938 EndPopup ,
4039}
4140
@@ -1028,8 +1027,10 @@ fn traverse_elements(
10281027 }
10291028 }
10301029 kAXGroupRole if element. subrole ( ) . is_ok_and ( |r| r == "AXApplicationDialog" ) => {
1031- let _ = result_tx. send ( ElementSignal :: StartPopup ) ;
1032- is_popup = true ;
1030+ if let Some ( frame) = ele_fp. frame {
1031+ let _ = result_tx. send ( ElementSignal :: StartPopup ( frame) ) ;
1032+ is_popup = true ;
1033+ }
10331034 }
10341035 kAXGroupRole => match target {
10351036 Target :: Clickable if element. is_clickable ( ) => {
@@ -1051,13 +1052,11 @@ fn traverse_elements(
10511052 }
10521053 _ => ( ) ,
10531054 } ,
1054- kAXMenuRole
1055- if element. parent ( ) . and_then ( |p| p. role ( ) ) . is_ok_and ( |r| {
1056- r == kAXMenuButtonRole || r == kAXButtonRole || r == kAXCellRole
1057- } ) =>
1058- {
1059- let _ = result_tx. send ( ElementSignal :: StartPopup ) ;
1060- is_popup = true ;
1055+ kAXMenuRole => {
1056+ if let Some ( frame) = ele_fp. frame {
1057+ let _ = result_tx. send ( ElementSignal :: StartPopup ( frame) ) ;
1058+ is_popup = true ;
1059+ }
10611060 }
10621061 kAXMenuItemRole => match target {
10631062 Target :: Text => {
0 commit comments