RFR: 8354539: [macOS] ComboBox and Spinner disable system menu bar shortcuts [v2]

Martin Fox mfox at openjdk.org
Tue Jul 15 20:23:47 UTC 2025


On Tue, 15 Jul 2025 17:59:00 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

> Would it make sense to attempt fixing event consumption bugs in the ComboBox and Spinner first?

When a Spinner is the focus owner it receives all KeyEvents but KeyEvents still need to be delivered to its editor. There's no good way of doing that now short of consuming the original event and firing a copy. To fix this we would have to introduce new API's (like some form of PR #1632).

> And perhaps also look at fixing the dispatching of consumed events such as JDK-8303209 or JDK-8229467 (the latter has been by @mstr2 , I think prematurely)?

Those bugs have to do with how consumption is signaled which isn't relevant. All that's relevant is that the original event is being consumed, not how we find out about it.

JavaFX handles events using dispatch chains and currently the system menu doesn't participate in that machinery. This causes it to work very differently from a standard MenuBar (which places its accelerators in the Scene which is in the chain). One could argue that it's a bug that the system menu doesn't respond to KeyEvents the way a standard MenuBar would.

Another way to look at it: do we want to outlaw what ComboBox and Spinner are doing? It's not illegal to create a KeyEvent and fire it at a control. It's not illegal to consume a KeyEvent that originated in Glass. Things only fail when the system menu is in effect and, again, only because it doesn't participate in dispatch.

Because I agree with you, this PR is intrusive. I'm not fan and I wrote it. I think the system menu needs to participate in event dispatch and I haven't found any clean, tidy way of doing that.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1848#issuecomment-3075427863


More information about the openjfx-dev mailing list