JDK-8131666 : Accelerators must fire always, unless key combination is explicitly handled by Control
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 8u45
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: windows_7
  • CPU: x86_64
  • Submitted: 2015-07-16
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Relates :  
Description
Given a dialog having a "Help" button and a TextField, where the "Help" button is registered with the "F1" key combination in the scene's accelerator table, what people are used to is that pressing the "F1" key will show some helpful information, whether the TextField is focused or not.

This is what happens with native dialogs on the Windows platform, and presumably on other platforms, too. Unfortunately, the JavaFX platform behaves differently: The "F1" key has no effect once the TextField is focused. Not only this is annoying and counterintuitive, it also is inconsistent, as this effect only happens with text input controls. If we change the example a bit, we can find other combinations of focused controls and registered accelerators, which will ceise to fire. For example, a TextField even consumes the ENTER key so a dialog's default button will be "dead" until the focus is moved.

It is certainly valid behaviour that a control (or to be more precise: a skin) overrides behaviour of key combinations, but this should obviously be limited to key combinations which are actually handled by the control. In our example, there is no purpose in consuming the "F1" key, as a TextField does not use this key for anything at all. Hence, the result when an accelerator is working and when is not, is completely weird and not intuitive: Users simply do not understand why e. g. "F1" is not working on TextFields, as just "nothing" happens which looks like a "broken" key.

Hence I'd like to suggest checking the key handling of all controls and reduce the consumption of key events to only those which have an actual effect -- at least for Scene-registered accelerators. I have rated this issue as a bug with P3 priority, because the use of accelerators is completely flawed due to this issue, and the only workaround will be to not use the accelerators table at all but instead process key combinations manually on the scene level, which is a mess and leads to heavily unstructured code.
Comments
The specific case for F-keys is handled by JDK-8089884. A more general fix is needed, but will not be done for JDK 9.
17-09-2015

Attached test application demonstrates the problem: * Start application * Set focus on TextField * Press F1: Nothing will happen! * Set focus on Button "Help" * Press F1: Button does fire! This makes the F1 accelerator key pretty useless! As the TextField does not do anything with the F1 key, it makes no sense that it consumes the F1 pressed event.
20-07-2015

Reopened as requested test application is attached now.
20-07-2015

Marking as incomplete pending a test case.
17-07-2015

Please provide a simple test program that shows this bug.
16-07-2015