-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8339728 : [Accessibility,Windows,JAWS] Bug in the getKeyChar method of the AccessBridge class #22822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Welcome back abhiscxk! A progress list of the required criteria for merging this PR into |
|
@kumarabhi006 This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 8 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
|
@kumarabhi006 The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
|
@azuev-java Please review. |
| * @bug 8339728 | ||
| * @summary Tests that JAWS announce the shortcuts for JMenuItems. | ||
| * @library /java/awt/regtesthelpers | ||
| * @build PassFailJFrame |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since instructions mention JAWS i would either make this test Windows specific or if you want to test t on mac too i would rephrase the instructions so they are not OS specific. Either way will work for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
|
|
||
| keyCode = keyStroke.getKeyCode(); | ||
| debugString("[INFO]: Shortcut is: " + Integer.toHexString(keyCode)); | ||
| if (keyCode != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this check? If keyCode is not zero we return keyCode but if it is zero we will still return keyCode because we return zero after the condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the condition check is not needed. Updated.
azuev-java
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This version looks good. Manually tested with both JAWS and NVDA haven't found no functional regressions.
|
@prsadhuk please review |
aivanov-jdk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me except for minor comments.
You may want to bump up the copyright year to 2025 now.
|
|
||
| keyCode = keyStroke.getKeyCode(); | ||
| debugString("[INFO]: Shortcut is: " + Integer.toHexString(keyCode)); | ||
| return (char) keyCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| return (char) keyCode; | |
| return (char)keyCode; |
For consistency with the return statements above which have no space after the cast.
| menu.add(menuItem6); | ||
| menu.add(menuItem7); | ||
|
|
||
| frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should not define a default close operation for a manual test, the PassFailJFrame framework handles closing the test window and fails the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
| JFrame frame = new JFrame("A Frame with Menu"); | ||
|
|
||
| JMenuBar menuBar = new JMenuBar(); | ||
| JMenu menu = new JMenu("Menu with Keystrokes"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| JMenu menu = new JMenu("Menu with Keystrokes"); | |
| JMenu menu = new JMenu("Menu with shortcuts"); |
You refer to concept as “shortcuts” in the instructions.
| 2. Press Alt + M to open application Menu | ||
| 3. Navigate the Menu Items by using UP / DOWN arrow key | ||
| 4. Press Pass if you are able to hear correct JAWS announcements | ||
| for each menu item shorcut else Fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| for each menu item shorcut else Fail. | |
| 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
| @@ -1,5 +1,5 @@ | |||
| /* | |||
| * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. | |||
| * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this copyright also needs to be updated..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
| public class TestJMenuItemShortcutAccessibility { | ||
| public static void main(String[] args) throws Exception { | ||
| String INSTRUCTIONS = """ | ||
| 1. Start the JAWS aplication |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"application"
| 2. Press Alt + M to open application Menu | ||
| 3. Navigate the Menu Items by using UP / DOWN arrow key | ||
| 4. Press Pass if you are able to hear correct JAWS announcements | ||
| for each menu item shortcut else Fail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we need not expand what is "correct" JAWS announcements? like mentioning it should read aloud "full" shortcut text and not only the 1st character of shortcut
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated test instruction.
|
I ran the test with Java 21 and with the fix, and I confirm JAWS announces the shortcuts correctly now.
Should we submit a bug? It's a known problem now, but there's no fix for it. It could be a limitation that may be worth calling out in a release note. |
Yeah, as of now I don't have a fix for "Enter" key shortcut or it may be a limitation. |
|
/integrate |
|
Going to push as commit a46ae70.
Your commit was automatically rebased without conflicts. |
|
@kumarabhi006 Pushed as commit a46ae70. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
|
/backport :jdk24 |
|
@kumarabhi006 Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk. Note: these commands are just some suggestions and you can use other equivalent commands you know. Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk with the title Below you can find a suggestion for the pull request body:
|
|
/backport :jdk24 |
|
@kumarabhi006 Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk. Note: these commands are just some suggestions and you can use other equivalent commands you know. Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk with the title Below you can find a suggestion for the pull request body:
|
|
/backport jdk:jdk24 |
|
@kumarabhi006 Could not automatically backport
Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk. Note: these commands are just some suggestions and you can use other equivalent commands you know. Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk with the title Below you can find a suggestion for the pull request body:
|
For a JMenuItem with a shortcut like Ctrl + Comma, the
getKeyCharmethod of theAccessBridgeclass cuts the Comma text to the first character and hence transfersC (instead of Comma)via theAccessBridgeAPI. 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
getKeyCharmethod 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.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22822/head:pull/22822$ git checkout pull/22822Update a local copy of the PR:
$ git checkout pull/22822$ git pull https://git.openjdk.org/jdk.git pull/22822/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22822View PR using the GUI difftool:
$ git pr show -t 22822Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22822.diff
Using Webrev
Link to Webrev Comment