Durgaprasad
Durgaprasad

Reputation: 1951

Voice over do not work in NSMenu in status bar with custom view for NSMenuItem

I have added NSMenu in NSStatusBar. I have used custom views for first NSMenuItem with the setView: method to include progressIndicator. All other items are default.

Issue here is with VO (voice over for disabled people). When I enable VO from Setting -> Accessibility -> VoiceOver and press option+command+M+M it focus on menus in status bar. Now using left and right keys I navigate to my app and then press down key of open NSMenu.

I can got down and select my options but cannot change to other app (wifi, date) from here. When I remove this custom view item it works fine. I also observed same with one another app.

Do I need to set any properties for custom views.

Edit

I created sample app in swift.

        let menu = NSMenu()
        let menuitem1 = NSMenuItem()
        let view1 = NSView(frame: NSRect(x: 0, y: 0, width: 100, height: 30))
        menuitem1.view = view1
        menu.addItem(menuitem1)
        menu.addItem(NSMenuItem(title: "Print Quote", action: #selector(AppDelegate.printQuote(_:)), keyEquivalent: "P"))
        menu.addItem(NSMenuItem.separator())
        menu.addItem(NSMenuItem(title: "Quit Quotes", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q"))

Even in this simple app I cannot get VO working properly. Steps

  1. VO (control+option) + M + M

  2. VO + space to select our app options.

  3. VO + down key to navigate inside.

  4. Then try to go left or right in other apps. It do not switch to other app.

    Edit 2 Observation is when I choose custom view first and try to switch to other app it works. But once I choose normal menuitem from custom view it falls in some issue. Only solution I find is either have all default menu items or all items with custom view.

Upvotes: 3

Views: 252

Answers (1)

eh1412
eh1412

Reputation: 63

For my NSMenuItems displayed in a table, I can add the accessibilityLabel on the newAutoLayoutView.

NSView *cellView = [NSView newAutoLayoutView];
cellView.accessibilityLabel = @"Voiceover Tab Name";

Upvotes: 0

Related Questions