Skip to content

ComboBoxEnterHandling

Jeanette Winzenburg edited this page Dec 11, 2019 · 3 revisions
Note
this is a summary of how divers bugs around Enter have been handled and which consequences (including regression/s) it had. Loosely related to Event Dispatch for ActionEvent

ComboBox: History of Enter Handling

Summary

All are about how/when ENTER is/not delivered to receivers. They differ in ComboBox state (not-/editable), pressed/released state of the event, receivers being filters/handlers and the misbehavior. The latter comes in two groups:

Not delivered

JDK-8145515 and its regression JDK-8229914 for keyPressed

Broken dispatch sequence

JDK-8149622 and its unfixed counter-part JDK-8229924 for editable ComboBox

Overview of state, for simplicity focused on the two that are fixed

JDK-8145515 JDK-8149622

editable

true

false

key state

pressed

released

receiver

filter on editor

handlers and filters on combo and above

issue

not delivered

broken sequence

Chronology and Mechanics

  • fix of JDK-8145515: added support to disable keyEvent forwarding of TextFieldBehaviour, used in ComboBoxSkin to disable for its editor and at the same time explicitly fire all types of Enter down into the editor.

  • fix of JDK-8149622: restrict fire down to keyReleased - this introduced the regression for keyPressed

Real Issue

The underlying problem is that the editor is-a FakeFocusTextField which never is the focusOwner and consequently never receives keyEvents "naturally". Owning controls must take over the dispatch. Unfortunately, they do by using node.fireEvent(event) during receiving the event - this leads to a broken event dispatch sequence with unhealty side-effects, see for details.

A real fix should drive to remove all xx.fireEvent during receiving them. The most promising approach might be to put in place a custom EventDispatcher that modifies the dispatch path for keyEvents to include the editor. That’s actually working (read: I have a crude prototype) and fixes (nearly) all dispatch-related issues.