Search code examples
macosaccessibilityvoiceovernsstatusitem

OS X NSStatusItem How to set the accessibility title for VoiceOver


There is no direct API (as far as I can see) but some applications seem to have it.

Although Apple's own icons (e.g. fast user switching, keyboard layout switching) do not have it.


Solution

  • Since OS X 10.10, NSStatusItem has button property, which is a regular NSView-based control that conforms to NSAccessibility protocol and which allows to change accessibilityTitle property directly.

    On earlier versions of OS X, you can implement a custom button that looks and behaves exactly like vanilla NSStatusItem and assign it to the item via -[NSStatusItem setView:] method, then use -[NSView accessibilitySetOverrideValue:... forAttribute:NSAccessibilityTitleAttribute] on your custom control to provide a voiceover title.