RFR: 8339728 : [Accessibility, Windows, JAWS] Bug in the getKeyChar method of the AccessBridge class [v3]
Alexey Ivanov
aivanov at openjdk.org
Fri Jan 3 19:37:39 UTC 2025
On Thu, 2 Jan 2025 05:31:34 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:
>> For a JMenuItem with a shortcut like _Ctrl + Comma_, the `getKeyChar` method of the `AccessBridge` class cuts the _Comma_ text to the first character and hence transfers `C (instead of Comma)` via the `AccessBridge` API. For a shortcut _Ctrl + Comma_ in a menu item, screen readers announce _Ctrl + C_ instead of _Ctrl + Comma_ as shortcut. Same issue exists for **Enter, Period and other keys** as well where only the first character is returned from the getKeyChar method.
>>
>> Proposed fix is to ensure that the _char representation of the shortcuts_ is returned by the `getKeyChar` method and it worked fine except for **"Enter"** key. It is unclear to me why it has not announced by AT (JAWS) but I think that may be due to the char representation of the Enter key which is a Line Feed.
>>
>> AT was also not able to announce the _Tab and Space_ key as a shortcut. Adding these keys in the control key list in _AccessBridge_ and in supported control code list in _AccessBridgePackages_ files enabled them to be announced by AT.
>>
>> Manual test case is added to verify the shortcut for JMenuItems.
>
> Abhishek Kumar has updated the pull request incrementally with one additional commit since the last revision:
>
> Review comment update
Looks good to me except for minor comments.
You may want to bump up the copyright year to 2025 now.
src/jdk.accessibility/windows/classes/com/sun/java/accessibility/internal/AccessBridge.java line 3975:
> 3973: keyCode = keyStroke.getKeyCode();
> 3974: debugString("[INFO]: Shortcut is: " + Integer.toHexString(keyCode));
> 3975: return (char) keyCode;
Suggestion:
return (char)keyCode;
For consistency with the `return` statements above which have no space after the cast.
test/jdk/javax/accessibility/TestJMenuItemShortcutAccessibility.java line 49:
> 47: 3. Navigate the Menu Items by using UP / DOWN arrow key
> 48: 4. Press Pass if you are able to hear correct JAWS announcements
> 49: for each menu item shorcut else Fail.
Suggestion:
for each menu item shortcut else Fail.
Typo.
You should probably remove the period… to be consistent. Either add ending punctuation to each instruction item, nor don't add it at all, including the last item.
test/jdk/javax/accessibility/TestJMenuItemShortcutAccessibility.java line 65:
> 63:
> 64: JMenuBar menuBar = new JMenuBar();
> 65: JMenu menu = new JMenu("Menu with Keystrokes");
Suggestion:
JMenu menu = new JMenu("Menu with shortcuts");
You refer to concept as “shortcuts” in the instructions.
test/jdk/javax/accessibility/TestJMenuItemShortcutAccessibility.java line 107:
> 105: menu.add(menuItem7);
> 106:
> 107: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
You should not define a default close operation for a manual test, the `PassFailJFrame` framework handles closing the test window and fails the test.
-------------
Marked as reviewed by aivanov (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/22822#pullrequestreview-2529606057
PR Review Comment: https://git.openjdk.org/jdk/pull/22822#discussion_r1902098356
PR Review Comment: https://git.openjdk.org/jdk/pull/22822#discussion_r1902102157
PR Review Comment: https://git.openjdk.org/jdk/pull/22822#discussion_r1902101228
PR Review Comment: https://git.openjdk.org/jdk/pull/22822#discussion_r1902100219
More information about the client-libs-dev
mailing list