JDK-8061381 : [macosx] Accelerators does not spelled for JMenuItems by Voice Over
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8,9,10,11,13
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-10-17
  • Updated: 2020-02-04
  • Resolved: 2019-03-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 13
13 b14Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
1)Accelerators does not spelled for JMenuItems by Voice Over
2) There is no way to show a popup menu without a mouse
3)Alt-F mnemonic does not work on OS X (See also JDK-7156393). 

Install 8u40b08 and try the attached file.
Comments
It's time to push approved fix
28-02-2019

http://mail.openjdk.java.net/pipermail/swing-dev/2019-January/009340.html
15-02-2019

Initial version: http://cr.openjdk.java.net/~serb/8061381/webrev.00/
23-01-2019

1)Accelerators does not spelled for JMenuItems by Voice Over -- Still a problem 2) There is no way to show a popup menu without a mouse -- In the test above the next shortcut will open the menu: control+alt+F 3)Alt-F mnemonic does not work on OS X (See also JDK-7156393). -- On macOS the "control+alt+" should be used
10-01-2019

Approved by component triage team to defer
22-08-2016

I am OK with deferring. Until this is fixed, as a workaround, F10 can be used to move to the menubar.
22-08-2016

Pete, please look at this issue, are you Ok to defer it?
22-08-2016

The attached test code behaves same with JDK builds 8b132 and 9b131. Hence requesting to defer the issue.
22-08-2016

My tests were run using 9b110. What is the Swing spec on Mac for keyboard operation of the menu system when the menu system is in the app window and not in the top of screen menu? Should it operate like on Win? Or should it not be allowed since this is non-standard for Mac? Or how should it work? Native Win apps work like this: - Alt or F10 moves focus into/outof the menubar. - When focus is not in the menu system, Alt plus a menubar menu item mnemonic opens the popup and places focus own the first menu item of the popup. - When focus is on the menubar with no popups activated the mnemonic keys cause focus to move between menubar menu items. Native Mac apps work like this: - The top of screen Mac menubar is entered via control F2 - Then the first letters of any menubar menu item can be typed to select that menubar menu item. (Note: need to wait about 2 seconds after choosing one menu item before choosing the next one.) - Mac apps don���t have their menubars in the app window so there is no Mac spec for that; it might be argued that the current Swing behavior is ���out of spec��� and perhaps we should consider automatically using the apple.laf.useScreenMenuBar property when Swing apps run on Mac. Note that this bug is not about shortcuts.
24-03-2016

Still bugs: - Alt doesn���t move to menubar It is unclear why alt should move to the menubar. - Alt F doesn���t open Menu For mnemonics on OSX the ctrl+alt keys are used. Note that some of tested shortcuts by default reserved by the system(like ctrl+f1). Please confirm this. Also note that the latest jdk9 should be tested(jdk8 have some unfixed bugs).
24-03-2016

Sergey, please evaluate it.
23-03-2016

The following information was gathered using 9b110. From the bug description: - Are accelerators/shortcuts spoken? - Yes they are, when focus is on a menu item - Do accelerators/shortcuts work? - Note: For delete and F1-F12 have to press fn key. Mac delete without fn key is backspace - Mac menu, using -Dapple.laf.useScreenMenuBar="true" - control A: OK, with and without VO - control F1: handler called twice, with and without VO - control shift B: handler called twice, with and without VO - control shift F2: handler called twice, with and without VO - control option shift C: without VO, handler called twice; if VO, conflict with VO keys, copies last phrase to clipboard - control option shift F3: without VO, handler called twice; if VO, conflict with VO keys, cursor tracking off - control option shift delete: without VO, handler called twice; if VO, just hear a ding - control X: OK, with and without VO - Swing menu - Without VO: all OK except control shift F2 - With VO - control A/F1/X: OK - control shift F2 has side effect: focus to move to menu bar (in response to control F2) - control option shift C: conflict with VO keys, handler not called, copies last phrase to clipboard - control option shift F3: conflict with VO keys, handler not called, cursor tracking off - control option shift delete: conflict with VO keys, handler not called, just hear a ding - Do menu popups work - mac menu: OK - Swing menu: OK - Does Alt F work - mac menu: Use ctrl F2, then press T or F to go to menu item (but wait 2 seconds before retyping) - Swing menu: - F10 OK, moves focus to menu bar, opens first menu - Alt/option doesn���t move focus to menu bar - Alt/option F doesn���t open File menu - Pressing Alt does cause underlines to appear Summary, bug status: Unreproducible - accelerators are spoken when menu items get focus - popups work OK - Also note that these accessibility attributes are now implemented as seen by Accessibility Inspector: - AXMenuItemCmdChar - AXMenuItemCmdVirtualKeyAttribute // For non-standard keys like F key or Delete - AXMenuItemCmdModifiers Still bugs: - Alt doesn���t move to menubar - Alt F doesn���t open Menu New Bugs: - JDK-8152492 [macosx swing] double key event actions when using Mac menubar - JDK-8152494 [macosx swing] Should Mac command key map to InputEvent.CTRL_MASK?
23-03-2016

I changed this to subcomponent java.awt. If keyboard processing is handled in another subcomponent please reassign.
23-03-2016

Some comments when evaluating 8 GA alt/option F doesn���t open menu (the F is underlined when alt/option pressed) - Note that Swing menu should appear in the Mac Menu, not separately as a menu in the Swing window. - If the menu was in the proper place then the VO user would use control + option + M to get to the menu and left/right arrow to move through the menu. Note that Mac doesn���t have the concept of Mnemonics so no need to implement support for those. Swing is not providing support for accelerators (known as shortcut keys on OS X). On Mac the standard Swing modifier should be command, not control as is currently the case. When arrowing through the menu VO doesn���t read anything. According to Accessibility Inspector Swing is not implementing these interfaces - AXMenuItemCmdChar - AXMenuItemCmdVirtualKeyAttribute // For non-standard keys like F key or Delete - AXMenuItemCmdModifiers The AXMenuItemCmdModifiers bits shown via Accessibility Inspector are: bit 0: shortcut + shift bit 1: shortcut + option bit 2: shortcut + control bit 3: no command key For the Test.java test case these should be set as follows (assuming for now that control is used instead of command) Alpha (control A): char = A, modifiers = bits 3,2 F1 (control F1): virtual key = 122, modifier: bits 3,2 Bravo (control shift B): char = B, modifiers = bits 3,2,0 F2 (control shift F2): virtual key = 120, modifier = bits 3,2,0 Charlie (control shift option C): char = C, modifiers = bits 3,2,1,0 F3 (control shift option F3): virtual key = 99, modifier = bits 3,2,1,0 Del (control shift option delete): virtual key = 51, modifier = bits 3,2,1,0 Exit (control X): char = X, modifier: bits 3,2 If command instead of control was used then bits three and two would be off Note: I don���t know the proper Cocoa way to get key codes but this image might be helpful http://boredzo.org/blog/wp-content/uploads/2007/05/imtx-virtual-keycodes.png
22-03-2016

From Alexandr Scherbatiy: There is the "apple.laf.useScreenMenuBar" system property that puts a Swing menu at the top of the screen on Mac OS X: https://developer.apple.com/library/mac/documentation/Java/Reference/Java_PropertiesRef/Articles/JavaSystemProperties.html For example: java -Dapple.laf.useScreenMenuBar="true" com.example.yourApp
22-03-2016

From what I read in that bug and the one it refers to JDK-7151821 it's not clear but I suspect it won't solve the issue. Here is summary of problems (which likely need review by a OS X UX architect). - The Swing menu is not on the OS X menu bar which is where it should be on OS X, not in a menu bar of the app's window. Voice Over's jump to menu feature doesn't know about a menu bar attached to an app's window, only about the OS X menu. - Alt F accelerator (not mnemonic) doesn't open the menu on the java app's menu bar (but I don't think this would be an issue if the first item was fixed. - The standard modifier on OS X is command not control so keys coded to use control as a modifier should be mapped command - The accelerators are not being mapped to these attributes: AXMenuItemCmdChar/AXMenuItemCmdVirtualKeyAttribute and AXMenuItemCmdModifiers
06-11-2014

Does fixing JDK-7156393 helps to solve your issue?
06-11-2014

Alexander Scherbatiy, I'd appreciate your comments on the above.
03-11-2014

On Mac a JRE install only installs support for applets, i.e. browser plugins. The JDK installs support for applications.
28-10-2014

I installed jre 9 b35 on MBP OS X Mavericks. java -version shows my old 8u40 EA b09. The control panel shows 9 b35. ptb-mbp-2:~ petebrunet$ ls -l /usr/bin/java lrwxr-xr-x 1 root wheel 74 Jun 24 18:24 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java That is 8u40. The control panel shows 9 ea here: /Library/Internet Plug-ins/JavaAppletPlugin.plugin/Contents/Home/bin/java I installed 9 EA via the DMG file. Is there an install bug? Or an operator error?
28-10-2014

does it reproducible on 8 GA ? 9?
18-10-2014