Supporting "+" and "-" accelerators on the numeric keypad
Martin Fox
martin at martinfox.com
Tue May 2 16:35:56 UTC 2023
One of the most common keyboard accelerators involving a symbol is Shortcut+'+' (plus sign). It’s often assigned to a menu item like Zoom In or Bigger. To target + in a way that works regardless of keyboard layout this has to be specified using a KeyCharacterCombination. Using a KeyCharacter combo also ensures the user can invoke the accelerator without using the Shift key on layouts where + is a shifted character.
On Windows and Linux KeyCharacter combos only work on the main keyboard and not the numeric keypad. This surprises users and developers and there’s a bug entered against it (see JDK-8089373). The work-around is to add an accelerator to the scene that performs the same action and targets KeyCode.ADD. Since a menu item can only have one accelerator this would have to be managed in code outside the menu system. I’m not familiar enough with JavaFX app development to comment on how much effort that would involve.
On the Mac a KeyCharacter combo targeting + will work on both the main keyboard and the numeric keypad (in fact it works more reliably from the keypad). So there’s also platform discrepancy that needs to be resolved.
I’m inclined to fix JDK-8089373 and make KeyCharacterCombinations work on the numeric keypad on all platforms. I’ve got the necessary changes queued up for Windows but wanted to get some buy-in before submitting the PR. The same PR would fix some other problems related to + char combos (they don’t work on German layouts) but I can easily drop the changes that enable the keypad.
https://bugs.openjdk.org/browse/JDK-8089373
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20230502/e76a807a/attachment.htm>
More information about the openjfx-dev
mailing list