Accelerator in System MenuBar

Dean Wookey wookey.dean at
Tue Mar 19 13:38:30 UTC 2019

Returning a boolean in View.notifyKey may also be useful for the windows
bug: where, regardless of
whether the accelerator is missing or not, there is a beeping sound.
Ideally there would be a beep only if the event isn't consumed.


On Tue, Mar 19, 2019 at 3:23 PM Johan Vos <johan.vos at> wrote:

> Related to
> The issue appears on Mac, with a system menubar. When the scene contains
> e.g. a TextField (which has a CMD-V keymapping), and a menuitem has been
> assigned a CMD-V accelerator, the latter should not be invoked when the
> action is performed on the TextField.
> When the menuitem is in a normal JavaFX MenuBar, this works fine as the
> event handling marks the event as consumed when the TextField processes it,
> hence it won't continue to the accelerators.
> However, when the menuitem is in a system menubar, the native
> performKeyEquivalent function first calls the the Java layer
> (View.notifyKey) and then unconditionally passes the event so that the
> system can process it.
> My thinking is that this can be avoided by having the View.notifyKey
> returning a boolean, which is true when the Java layer consumed the event,
> in which case the native performKeyEquivalent should return YES.
> Before I create a PR on this, I wonder if there are other ideas for doing
> this?
> - Johan

More information about the openjfx-dev mailing list