VoiceOver focus does not move with keyboard focus while navigating through Mac app menu items

I have a Mac application of type agent (LSUIElement is true).

When app is executed, app icon is shown in top menu bar. On clicking the app icon in menu bar, menu items (NSMenuItem) are displayed.


Please find below my observations on following two scenarios:


1. App is executed without assigning tooltip to menu items:

While navigating using keyboard, VoiceOver focus remains on menu item on which there is a keyboard focus.

This is working as expected.


2. App is executed after assigning tooltip to menu items (using setTooltip method):

While navigating through menu items using keyboard, suddenly VoiceOver focus is shifted to some other UI element on screen (e.g. Finder window, Safari window, etc) or VoiceOver focus does not move with keyboard focus.

I observed that, this happens when keyboard focus is kept on a menu item for some time (e.g. around 4-5 seconds) before navigating to other menu item.


This is not working as expected.

Ideally, VoiceOver focus should move with keyboard focus even if tooltip is assigned to menu items.


Can anyone please tell me how to fix this.