Repository navigation
Conversation
🦋 Changeset detectedLatest commit: b0dffd0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
|
Thanks, brenelz. I couldn't push to your fork from here, so this continues in #4325. That PR keeps your commit and drops the Generated by Claude Code |
|
Merged as #4325 (76e9094), which keeps your commit and drops the Generated by Claude Code |
Summary
Delegated dispatch left its overrides on the native event.
eventHandlerdefines an owncurrentTargetgetter on the event and never removes it. It also writestargetback as an own property when the walk ends. Since 2.0 delegates at the render root container, every native listener above the root (document,window,body, or any ancestor element) runs after Solid's listener in the same dispatch. Each of those listeners read Solid's last walked node ase.currentTargetinstead of its own element, which breaks click-outside handlers, analytics listeners, and third-party scripts.The walk now runs inside
try. Afinallyblock deletes the owntargetandcurrentTargetproperties, so the prototype getters apply again, even when a handler throws. Nested roots still work, because an outer root defines its own getter when its listener runs.Left open: dispatching the same
Eventobject a second time still skips delegated handlers, because the$$EVENT_OWNERmark persists on the event. Ignoring a stale mark needs per-container bookkeeping, which measured +131 B minified and failed the size gate, so this PR leaves it out. The two tests for that case are markedtest.fails.Behavior changes:
e.currentTargetafter anawaitnow getsnull, as native DOM does. Before, it got the last node Solid visited.e.targetinstead of the inner node.How did you test this change?
packages/web/test/delegated-event-restore.spec.tsx(new) covers:documentlistener above the root reading its owncurrentTarget;currentTarget;target;These 4 tests fail on
next55c7329 and pass with this change. The 2 re-dispatch cases aretest.fails.cd packages/web && npx vitest run(default config): 1,450 tests pass.npx vitest run --config vite.config.hydrate.mjs: 554 tests pass.c09-no-phantomfailed once during the full run; it passes alone and on unchangednext.npx vitest run --config vite.config.server.mjs: 1,818 tests pass.lone-spread-hydration-key-4240fails, and it fails the same way on unchangednextwith the published rc.18 compiler binary.node scripts/size/size.mjs --no-gate --jsonagainstnext55c7329, thennode gate.mjs. The change is +36 B minified in scenarios that include the web client, and every scenario passes the gate.🤖 Generated with Claude Code