Prioritized event handlers
Michael Strauß
michaelstrau2 at gmail.com
Sun Oct 29 04:20:56 UTC 2023
Hi John,
from what I understand, you're essentially suggesting a third phase of
event dispatch:
1. The event starts at the root and travels to the event target
(capturing phase)
2. If the event is not consumed, it travels back to the root, but
default handlers are excluded (bubbling phase)
3. If the event is still not consumed, the bubbling phase is repeated
for default handlers.
Maybe a generalization of that would be the following:
Both the capturing phase and the bubbling phase are repeated for each
priority level, beginning with the highest priority. In each
iteration, the event is only received by handlers with the
corresponding priority. If the event is consumed, it is not propagated
further.
Installing a handler with higher priority therefore has the effect of
"hiding" all handlers with lower priority for the iteration that
corresponds to the handler's priority.
"Blocking default processing" could be achieved by marking the event
as "skip for any lower priority level". This would complete the event
dispatch for the current priority, and then stop.
More information about the openjfx-dev
mailing list