How do I specify values โ€‹โ€‹for the accessibility attribute for a menu item when using a custom view?

I am writing a custom view NSMenuItem

that I would like to make available. When I don't override accessibilityIsIgnored

(so the NSView

default is returned YES

), I can see in the Accessibility Inspector that there is a main object in the accessibility hierarchy AXMenuItem

for the menu item using a custom view, but the main part of the required attributes for the menu items , such as Title , is missing :

Screenshot of Accessibility Inspector locked on the AXMenuItem accessibility object, when ignoring accessibility

Required attributes are set for menu items that do not use a custom view.

When I override accessibilityIsIgnored

to return NO

then this results in an additional accessibility object being added to the hierarchy (object by default AXUnknown

):

Screenshot of Accessibility Inspector locked on the AXUnknown accessibility object under the AXMenuItem object, when not ignoring accessibility

The attribute values โ€‹โ€‹returned by the override accessibilityAttributeValue:

are applied to that object AXUnknown

underneath AXMenuItem

, not to the desired effect on the object itself AXMenuItem

.

How do I specify missing attribute values โ€‹โ€‹for a menu item?

+3
objective-c cocoa uiaccessibility nsmenuitem


source to share


No one has answered this question yet

Check out similar questions:

7
Custom NSView in NSMenuItem does not accept mouse events
4
to set the names of items in the main menu of my application?
4
How do I hide a menu item with a custom view?
3
Cocoa - Custom NSView in NSMenuItem will not draw
1
Changing NSCursor for NSView over NSTextView
1
How to start custom view of NSMenuItem after selection?
1
How to bind a NSMenuItem based on a view in an NSPopUpButton menu?
0
NSStatusItem with custom view, alpha value and multiple displays
0
How to use one NSValueTransformer subclass to toggle titles of multiple menu items
0
Custom NSMenuItem-views crash when scrolling NSMenu on low resolution screen



All Articles
Loading...
X
Show
Funny
Dev
Pics