ripple@0.3.124
·
3 commits
to main
since this release
Patch Changes
-
#1434
2f4d02d
Thanks @chenzylab! - Fix event delegation
breaking when multiple roots (Portals, mounts) share or mix targets.handle_root_events(target)had no notion of multiple callers sharing the
sametargetelement. Each Portal (or the app root) calls it once on mount;
its cleanup unconditionally removed the delegated event listeners from
target. When two Portals both mount todocument.body(e.g. a Modal and a
SideSheet), closing the first tore down the delegated listeners for
document.bodyentirely, silently breaking every click inside the second — no
error, no warning.handle_root_eventsnow ref-counts callers per target, and
the delegated listeners are only torn down once every caller for that target
has released it.- The single
root_targetglobal is gone.on()now checks the element against
every active root target, so attaching a listener directly to one root's
target while another root (e.g. a Portal to a sibling layer) was acquired
later no longer silently takes the broken delegated path. Portalacquires root event delegation in its own render block keyed on
target, so a children-only update no longer releases and re-adds every
delegated listener on the target.