Navigation KeyEvents consumed when there is nothing to navigate, bug?

John Hendrikx john.hendrikx at gmail.com
Fri May 19 02:01:10 UTC 2023


My question is:

When a control has focus, and a navigation key is pressed that has no 
effect, should the navigation key be consumed?

With no effect I mean:

- TAB / SHIFT-TAB is not changing focus because there is only a single 
control that can receive focus (the tab keys will loop back to 
first/last controls)
- UP/DOWN/LEFT/RIGHT keys is not changing focus because there is no 
control that can receive focus that is further up, down, left or right 
than the current control

IMHO, it shouldn't because events that you're not acting upon should not 
be consumed.

My use case where this matters:

I have a fully keyboard controlled application. When pressing a hotkey 
to change some state, a popup window appears briefly confirming the 
state change.  This popup can contain a fully functioning control (like 
a slider, spinner or checkbox) to show the current state, but also to 
interact with it further (using keys only).  Any event that is not 
relevant for the popup will close the popup immediately.  In other 
words, I press a key to increase volume, a volume control briefly 
appears, and when I press LEFT/RIGHT (the volume control is horizontally 
orientated) I can also adjust the volume further.  When I press a key 
not handled by the popup, the popup closes and the event is forwarded to 
the original Scene -- this works for all keys, except the navigation keys.

So, the Navigation keys are always consumed by the focused control in 
the popup, whether it can use them or not.  A slider can use left/right 
or up/down depending on orientation, but the other keys should bubble 
through, yet they're all consumed.  So when I press UP or DOWN for a 
horizontal slider, it tries to navigate to another control, but there is 
none (the popup only contains one control).  The key is however consumed 
despite not being usable.

--John




More information about the openjfx-dev mailing list