RFR: 8360886: Cmd + plus shortcut does not work reliably.
Martin Fox
mfox at openjdk.org
Mon Jun 30 21:35:44 UTC 2025
On Mon, 30 Jun 2025 20:59:50 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> I could write a weaker system test. The problem sequence is CMD + EQUALS. There are two possible outcomes depending on the keyboard layout; either the EQUALS yields nothing or it generates a PRESSED event that matches against KeyCharacterCombination("=", KeyCode.SHORTCUT_DOWN). It's not quite the same test but it would have caught this bug. I can verify that it would work on all the keyboard layouts that Apple ships with macOS 15.
>>
>> I'm less sure if the test would work cross-platform. It should but I don't have a good way of enumerating and testing all the layouts on Windows and Linux.
>
> I was thinking more in terms of exhaustive checking of all the available keys (so we won't encounter another scenario when a bug is introduced similar to #1528, if that is possible).
>
> I know we can't really control the keyboard layout, so perhaps what I am asking may not be possible since these tests might fail on other layouts.
>
> So let me ask
> - is the problem limited to cmd+= on the US keyboard?
> - could we have a different behavior with a different kb layout (German? French?)
> - what happens when the user attaches an external USB or bluetooth keyboard?
The issue here is limited to cmd+= and cmd+period. These receive special treatment by macOS. To counter-act this they also receive special treatment in the Glass code.
The macOS special handling of cmd+= only applies to certain keyboard layouts (for example, English but not German). But that's not true for Glass, the work-around in glass applies to all layouts.
I will look into writing up a system test. I think I can put one together that tests more keys and works on all layouts. It would be nice not to rely solely on this manual test.
External USB or bluetooth keyboards shouldn't make a difference.
(In case you're curious, Apple wants to make sure you can invoke Cmd + "+" by holding down Cmd and pressing any key that has a "+" symbol printed on it. On a US English layout that means Cmd + "=" should also work. So they send us Cmd + "=" and if that doesn't trigger a shortcut they send us Cmd + "+". Glass tries to ensure that that second event doesn't turn into another KeyEvent. I think this only happens with keys where "+" is Shift + "=" which is why it happens on US English but not German.)
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1837#discussion_r2176001239
More information about the openjfx-dev
mailing list