8000 [kyo-ui] a click on an element that has left the page reaches nothing instead of its former parent's handler by xsistens · Pull Request #2201 · getkyo/kyo · GitHub
[go: up one dir, main page]

Skip to content

[kyo-ui] a click on an element that has left the page reaches nothing instead of its former parent's handler - #2201

Open
xsistens wants to merge 1 commit into
getkyo:mainfrom
xsistens:fix/ui-dispatch-removed-element
Open

xsistens wants to merge 1 commit into
getkyo:mainfrom
xsistens:fix/ui-dispatch-removed-element

Conversation

@xsistens
Copy link
Copy Markdown
Contributor

Closes #2200

Problem

When the server dispatches a client event and the next path segment names no current child, the event bubbles to the enclosing element as if the user had clicked it. This happens in dispatch (an element with neither a reactive nor a static child for the segment) and in the fragment handle built by walkStatic (a key or index matching no child, as for an item a foreach has just removed). Since every rendered child is normalized into one of those entries, such a segment can only name an element removed since the client sent the event.

Solution

Both branches now return false and run no handler. Children that are still rendered but have no handlers of their own keep bubbling, since they reach dispatch through their own handle.

Notes

  • Two new tests in UIEventWiringTest cover a removed static child and a removed foreach item, each next to a handler-less element that must still bubble. Both fail on main with (1, 2) toggles and pass with the fix.
  • An unkeyed foreach can still resolve a stale index to a different item; that is out of this change's reach and noted in the issue.

@xsistens
xsistens force-pushed the fix/ui-dispatch-removed-element branch from e7d68af to 0724ba1 Compare October 25, 2026 12:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kyo-ui: a click on an element that is no longer rendered runs its former parent's handler

1 participant

0