On Fri, 8 Nov 2024 22:05:15 GMT, Martin Fox <[email protected]> wrote:
> FWIW, checking the isConsumed flag will only work if the action is consumed
> by a handler registered directly with the TextField. If there's a filter or
> handler attached to some other part of the scene graph a copy of the event
> will be made and consumed and `actionEvent.isConsumed()` will return false. A
> more complete fix is to replace `textField.fireEvent` with a call to
> `EventUtil.fireEvent` and check for a `null` return value.
It seems that an earlier check I did to see if events are copied wasn't done
correctly. Indeed events are copied at every filter/handler. That does seem
excessive. It also makes the public `Node#fireEvent` a bit useless for proper
event propagation for normal users that don't have access to `EventUtil`.
I checked the events that are copied, and it is basically making the copy to
adjust the source (target remains constant). That's really odd; I'd expect the
source to remain the same as well (ie. the Scene or Window, not the "previous"
filter/handler Node level), especially as it is documented as:
/**
* The object on which the Event initially occurred.
*
* @return the object on which the Event initially occurred
*/
public Object getSource() {
return source;
}
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/15#discussion_r1835173141