Skip to content

Conversation

@kumarabhi006
Copy link
Contributor

@kumarabhi006 kumarabhi006 commented Dec 19, 2024

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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8339728: [Accessibility,Windows,JAWS] Bug in the getKeyChar method of the AccessBridge class (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22822/head:pull/22822
$ git checkout pull/22822

Update a local copy of the PR:
$ git checkout pull/22822
$ git pull https://git.openjdk.org/jdk.git pull/22822/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22822

View PR using the GUI difftool:
$ git pr show -t 22822

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22822.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 19, 2024

👋 Welcome back abhiscxk! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Dec 19, 2024

@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:

8339728: [Accessibility,Windows,JAWS] Bug in the getKeyChar method of the AccessBridge class

Reviewed-by: aivanov, psadhukhan, kizune

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 master branch:

  • 12700cb: 8346264: "Total compile time" counter should include time spent in failing/bailout compiles
  • dd81f8d: 8344079: Minor fixes and cleanups to compiler lint-related code
  • ccf3d57: 8346985: Convert test/jdk/com/sun/jdi/ClassUnloadEventTest.java to Class-File API
  • 594e519: 8346984: Remove ASM-based benchmarks from Class-File API benchmarks
  • c027f2e: 8346983: Remove ASM-based transforms from Class-File API tests
  • e0695e0: 8346981: Remove obsolete java.base exports of jdk.internal.objectweb.asm packages
  • dfaa891: 8346569: Shenandoah: Worker initializes ShenandoahThreadLocalData twice results in memory leak
  • f1d85ab: 8346773: Fix unmatched brackets in some misc files

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 19, 2024
@openjdk
Copy link

openjdk bot commented Dec 19, 2024

@kumarabhi006 The following label will be automatically applied to this pull request:

  • client

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.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Dec 19, 2024
@mlbridge
Copy link

mlbridge bot commented Dec 19, 2024

Webrevs

@kumarabhi006
Copy link
Contributor Author

@azuev-java Please review.

* @bug 8339728
* @summary Tests that JAWS announce the shortcuts for JMenuItems.
* @library /java/awt/regtesthelpers
* @build PassFailJFrame
Copy link
Member

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.

Copy link
Contributor Author

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) {
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

@azuev-java azuev-java left a 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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 2, 2025
@victordyakov
Copy link

@prsadhuk please review

Copy link
Member

@aivanov-jdk aivanov-jdk left a 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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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);
Copy link
Member

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.

Copy link
Contributor Author

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");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jan 6, 2025
@@ -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.
Copy link
Contributor

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..

Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated test instruction.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 6, 2025
@aivanov-jdk
Copy link
Member

I ran the test with Java 21 and with the fix, and I confirm JAWS announces the shortcuts correctly now.

…it worked fine except for Enter key…

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.

@kumarabhi006
Copy link
Contributor Author

…it worked fine except for Enter key…

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.
I am not sure if filing a bug is a good idea as it may just increase the backlog with no potential solution.

@kumarabhi006
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 9, 2025

Going to push as commit a46ae70.
Since your change was applied there have been 58 commits pushed to the master branch:

  • 97dd06c: 8347299: Add annotations to test cases in LicenseTest
  • 0a35ebf: 8347297: Skip the RuntimeImageSymbolicLinksTest test on Windows when it is executed outside of the jtreg
  • b3e8736: 8347296: WinInstallerUiTest fails in local test runs if the path to test work directory is longer that regular
  • 1ade96b: 8347042: Remove an extra parenthesis in macro definition in jfrTraceIdMacros.hpp
  • db7fa6a: 8347289: HKDF delayed provider selection failed with non-extractable PRK
  • 0a5ef82: 8347162: Update problemlist CR for vmTestbase/nsk/jdi/VMOutOfMemoryException
  • ea49537: 8310340: assert(_thread->is_interp_only_mode() || stub_caller) failed: expected a stub-caller
  • 2e00816: 8346671: java/nio/file/Files/probeContentType/Basic.java fails on Windows 2025
  • 88fa3b2: 8346998: Test nsk/jvmti/ResourceExhausted/resexhausted003 fails with java.lang.OutOfMemoryError when CDS is off
  • 6ee2bd2: 8347147: [REDO] AccessFlags can be u2 in metadata
  • ... and 48 more: https://git.openjdk.org/jdk/compare/9393897817a3280e08a8278b86df71f59608be9c...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 9, 2025
@openjdk openjdk bot closed this Jan 9, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 9, 2025
@openjdk
Copy link

openjdk bot commented Jan 9, 2025

@kumarabhi006 Pushed as commit a46ae70.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@kumarabhi006
Copy link
Contributor Author

/backport :jdk24

@openjdk
Copy link

openjdk bot commented Jan 10, 2025

@kumarabhi006 Could not automatically backport a46ae703 to openjdk/jdk due to conflicts in the following files:

  • src/jdk.accessibility/windows/classes/com/sun/java/accessibility/internal/AccessBridge.java

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.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk.git jdk24:jdk24

# Check out the target branch and create your own branch to backport
$ git checkout jdk24
$ git checkout -b backport-kumarabhi006-a46ae703-jdk24

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk.git a46ae7031e30eb4940e43012a42f1b7fa5d942ef

# Backport the commit
$ git cherry-pick --no-commit a46ae7031e30eb4940e43012a42f1b7fa5d942ef
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport a46ae7031e30eb4940e43012a42f1b7fa5d942ef'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk with the title Backport a46ae7031e30eb4940e43012a42f1b7fa5d942ef.

Below you can find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit a46ae703 from the openjdk/jdk repository.

The commit being backported was authored by Abhishek Kumar on 9 Jan 2025 and was reviewed by Alexey Ivanov, Prasanta Sadhukhan and Alexander Zuev.

Thanks!

@kumarabhi006
Copy link
Contributor Author

/backport :jdk24

@openjdk
Copy link

openjdk bot commented Jan 10, 2025

@kumarabhi006 Could not automatically backport a46ae703 to openjdk/jdk due to conflicts in the following files:

  • src/jdk.accessibility/windows/classes/com/sun/java/accessibility/internal/AccessBridge.java

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.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk.git jdk24:jdk24

# Check out the target branch and create your own branch to backport
$ git checkout jdk24
$ git checkout -b backport-kumarabhi006-a46ae703-jdk24

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk.git a46ae7031e30eb4940e43012a42f1b7fa5d942ef

# Backport the commit
$ git cherry-pick --no-commit a46ae7031e30eb4940e43012a42f1b7fa5d942ef
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport a46ae7031e30eb4940e43012a42f1b7fa5d942ef'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk with the title Backport a46ae7031e30eb4940e43012a42f1b7fa5d942ef.

Below you can find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit a46ae703 from the openjdk/jdk repository.

The commit being backported was authored by Abhishek Kumar on 9 Jan 2025 and was reviewed by Alexey Ivanov, Prasanta Sadhukhan and Alexander Zuev.

Thanks!

@kumarabhi006
Copy link
Contributor Author

/backport jdk:jdk24

@openjdk
Copy link

openjdk bot commented Jan 10, 2025

@kumarabhi006 Could not automatically backport a46ae703 to openjdk/jdk due to conflicts in the following files:

  • src/jdk.accessibility/windows/classes/com/sun/java/accessibility/internal/AccessBridge.java

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.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk.git jdk24:jdk24

# Check out the target branch and create your own branch to backport
$ git checkout jdk24
$ git checkout -b backport-kumarabhi006-a46ae703-jdk24

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk.git a46ae7031e30eb4940e43012a42f1b7fa5d942ef

# Backport the commit
$ git cherry-pick --no-commit a46ae7031e30eb4940e43012a42f1b7fa5d942ef
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport a46ae7031e30eb4940e43012a42f1b7fa5d942ef'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk with the title Backport a46ae7031e30eb4940e43012a42f1b7fa5d942ef.

Below you can find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit a46ae703 from the openjdk/jdk repository.

The commit being backported was authored by Abhishek Kumar on 9 Jan 2025 and was reviewed by Alexey Ivanov, Prasanta Sadhukhan and Alexander Zuev.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client client-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

5 participants