Skip to content

Announce function key shortcut keys in java swing applications#13676

Merged
seanbudd merged 9 commits into
nvaccess:masterfrom
aphtech:jabShortcutKeys
May 19, 2022
Merged

Announce function key shortcut keys in java swing applications#13676
seanbudd merged 9 commits into
nvaccess:masterfrom
aphtech:jabShortcutKeys

Conversation

@mwhapples

@mwhapples mwhapples commented May 9, 2022

Copy link
Copy Markdown
Contributor

Link to issue number:

Closes #13643

Summary of the issue:

In a Java swing application NVDA was not announcing function keys in the shortcut keys. I also suspect it was not announcing other special keys like backspace, delete, cursor keys, etc.

Description of how this pull request fixes the issue:

java access bridge defines modifier bits for function keys and control code keys and then uses specific values in the character field. This pull request checks for these bits and handles the shortcut key accordingly.

Testing strategy:

Manual and unit tests.

Known issues with pull request:

There are some keys not defined in the java access bridge constants (eg. space) and so those will be handled like normal character keys, I am not sure whether this is going to lead to correct speaking of space and similar keys. Also there are some keys which java supports but NVDA does not, these will be ignored by NVDA, as it used to.

Change log entries:

New features
Changes
Bug fixes
Fix issue where function key shortcuts were not spoken in Java swing applications.
For Developers

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests Done
    • System (end to end) tests Not done, only small amount of code which could be covered by this anyway.
    • Manual testing Done
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 308a963e60

@mwhapples

Copy link
Copy Markdown
Contributor Author

I am aware of the lint failure, but I could not find a code style which would satisfy it. The issue seems to be about indentation and when I fix the one it leads to another which implies doing it the way I originally did it. So I have done it the closest to the guidelines in the contributor documentation.

@josephsl

josephsl commented May 9, 2022 via email

Copy link
Copy Markdown
Contributor

@mwhapples

Copy link
Copy Markdown
Contributor Author

I have taken a look about things like keys such as escape, enter, space, tab, etc. NVDA just reads the first letter of the words (eg. S for space, T for tab, etc). The biggest problem is that enter and escape are both E. I also tested that with Jaws and Jaws does similar for these shortcut keys, so I think it is a Java Access Bridge limitation/bug, so this PR is probably the best we can do at the moment.

@mwhapples

Copy link
Copy Markdown
Contributor Author

This also fixes issue #10994

@seanbudd seanbudd self-requested a review May 11, 2022 02:53

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've pushed a commit to fix the lint.

I've also pushed a commit to change the constants to enums.
This is preferred for new groups of constants, however we need to keep the previous naming scheme backwards compatible for add-ons.

I've asked for some help finishing up the documentation but this PR LGTM otherwise.

Comment thread source/JABHandler.py Outdated

class Accessible(IntFlag):
"""
TODO: The documentation for this mapping is here:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mwhapples would you be able to add to this docstring

Comment thread source/JABHandler.py Outdated
class AccessibleVK(IntEnum):
"""
The supported control code keys related to Accessible.CONTROLCODE_KEYSTROKE.
TODO: The documentation for this mapping is here:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mwhapples would you be able to add to this docstring

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just pushed a commit giving the documentation that these constants are defined in the JDK in header include/win32/bridge/AccessBridgePackages.h

@seanbudd seanbudd marked this pull request as draft May 16, 2022 04:49
@seanbudd seanbudd marked this pull request as ready for review May 19, 2022 01:38
@seanbudd seanbudd changed the title Fix issue #13643 not announcing function key shortcut keys in java swing applications Announce function key shortcut keys in java swing applications May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NVDA does not announce F-keys as Keystrokes of JMenuItems (Java Access Bridge) Keyboard shortcut is sometimes not properly read for Java applications

5 participants