Skip to content

fix(devtools): delegate the full Solid DelegatedEvents set on the PiP window - #38

Open
detail-app[bot] wants to merge 1 commit into
mainfrom
detail/bug-fix/fix-devtools-delegate-the-full-solid-delegatedeven-e1dd55
Open

detail-app[bot] wants to merge 1 commit into
mainfrom
detail/bug-fix/fix-devtools-delegate-the-full-solid-delegatedeven-e1dd55

Conversation

@detail-app

@detail-app detail-app Bot commented Nov 2, 2026

Copy link
Copy Markdown

Detail bug report: View on Detail

🎯 Changes

In picture-in-picture (detached) mode the entire Solid devtools tree is portaled into the popup window's own document. Solid's delegated events (e.g. onDblClick, onClick) don't attach per-node listeners — the runtime stores handlers on the element (el.$$<event>) and fires them through a single document-level listener installed by delegateEvents() on the document the event targets.

requestPipWindow() in packages/devtools/src/context/pip-context.tsx registered a hand-picked list of only 9 delegated events on the popup document, so any delegated handler rendered into the detached window for an event outside that list was dead. dblclick was missing, so the splitter's double-click-to-reset (PR TanStack#515) silently did nothing in the PiP window while working fine in the inline panel — and the stale list was a latent trap for any future delegated handler.

Fix: register the full Solid DelegatedEvents set on the popup document, mirroring what Solid's runtime does on the main document by default:

import { delegateEvents, DelegatedEvents } from 'solid-js/web'
// ...
delegateEvents([...DelegatedEvents], pip.document)

This is future-proof: any delegated event rendered in the popup now works without having to extend a separate, mode-specific list.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Testing

Added two unit tests in packages/devtools/src/context/pip-context.test.tsx (mock the popup window.open since jsdom blocks it, then drive requestPipWindow()):

  • the popup document delegates every event in Solid's DelegatedEvents set (guards against regressing to a hand-picked list)
  • a delegated dblclick handler attached to a node in the popup document actually fires when dispatched

Added two Playwright E2E tests in e2e/apps/react-vite/tests/pip-delegated-events.spec.ts that open a real window.open popup (the unit tests can't, since jsdom blocks popups):

  • double-clicking the splitter inside the detached PiP window resets the panes to equal shares (the reported user scenario); both the rendered geometry and the persisted layout converge to equal sizes
  • the popup document's delegated-event set contains the previously-missing events (dblclick, beforeinput, contextmenu, keyup, mousemove, mouseup, touchstart)

Regression sanity-checked: reverting the source fix and rebuilding the devtools dist makes the delegation tests fail with the exact bug symptom (the popup document receives only the old 9-event list, and the PiP double-click leaves the panes unequal); re-applying the fix turns them green again.

Routine checks all pass: typecheck (tsc --noEmit), lint, the full @tanstack/devtools unit suite (376 tests), the package build (tsup) and publint, the bundle-size budget (dist/index.js = 65.68 kB ≤ 66 kB), the full repo gate pnpm test:pr (nx-affected eslint/sherif/knip/lib/types/build/build), and the full react-vite Playwright suite (34 tests, 2 pre-existing test.fixme skipped).


Automatic Fixes PRs can be configured here.

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.

0 participants