On Tue, 12 May 2026 17:18:35 GMT, Martin Fox <[email protected]> wrote:
> This PR alters the way ComboBox and Spinner deliver KeyEvents to their > TextField editors. When a ComboBox or Spinner is the focus owner it is the > target of all key events. Currently the skin installs a filter to catch key > events and re-fire most of them at the TextEdit. The skin copies the event, > fires the copy at the TextField, and then consumes the original event. This > confuses the system menu bar logic on macOS; only the original event can > trigger a menu item and that event is always being consumed. > > In this PR only the original key event makes its way up and down the event > dispatch chain. To drive the TextField the skin delivers the event copy > directly to the TextField's event dispatcher and only consumes the original > event if the TextField consumes the copy. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). I like this idea very much (will do more testing). Do you think these tickets are related or similar: https://bugs.openjdk.org/browse/JDK-8174991 https://bugs.openjdk.org/browse/JDK-8229914 https://bugs.openjdk.org/browse/JDK-8088897 https://bugs.openjdk.org/browse/JDK-8234247 https://bugs.openjdk.org/browse/JDK-8337246 https://bugs.openjdk.org/browse/JDK-8320557 Also, I wonder if other virtualized controls with embedded editors such as `ListView`, `Tree|TableView` might benefit from this fix? modules/javafx.controls/src/main/java/javafx/scene/control/skin/ComboBoxPopupControl.java line 188: > 186: if (dispatcher == null) return false; > 187: > 188: EventDispatchChain chain = new EventDispatchChainImpl(); would it make sense to create a public API to dispatch an event specifically to the given `Node`, bypassing the normal path (as in `Event.fireEvent` ?) something along the lines `EventUtil.fireEvent` ? modules/javafx.controls/src/test/java/test/javafx/scene/control/ComboBoxTest.java line 2548: > 2546: > 2547: // Ensure initial shortcut event is not consumed > 2548: @Test public void testShortcutNotConsumed() { I'd strongly encourage to place @Test annotation on its own line in all the new code... ------------- PR Review: https://git.openjdk.org/jfx/pull/2166#pullrequestreview-4284123316 PR Review Comment: https://git.openjdk.org/jfx/pull/2166#discussion_r3236370983 PR Review Comment: https://git.openjdk.org/jfx/pull/2166#discussion_r3236381623
