Navigation KeyEvents consumed when there is nothing to navigate, bug?
Martin Fox
martin at martinfox.com
Mon May 22 14:43:20 UTC 2023
I assume these events are consumed so the user doesn’t encounter surprising behavior when they hit the limits of the navigable area. If the user presses a navigation key a few too many times or holds it down to auto-repeat the navigation should either stop when they hit the edge or wrap around to the other side. If the extra keystrokes are left unconsumed they might be handled in some unexpected way.
That’s my conjecture, I haven’t tweaked the code and tried it out myself.
> On May 18, 2023, at 7:01 PM, John Hendrikx <john.hendrikx at gmail.com> wrote:
>
> 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