Skip to content

fix(devtools): reposition the docked edge trigger tab on window resize - #45

Open
detail-app[bot] wants to merge 1 commit into
mainfrom
detail/bug-fix/fix-devtools-reposition-the-docked-edge-trigger-ta-6c1fc8
Open

detail-app[bot] wants to merge 1 commit into
mainfrom
detail/bug-fix/fix-devtools-reposition-the-docked-edge-trigger-ta-6c1fc8

Conversation

@detail-app

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

Copy link
Copy Markdown

Detail bug report: View on Detail

🎯 Changes

Bug: While the floating trigger is docked against a viewport edge (the slim "edge tab"), a window resize never recomputed the tab's along-edge pixel position. The resize listener early-returned when docked (a guard added alongside the dock feature in TanStack#521), and edgeTabStyle computed its top/left from a non-reactive viewport read plus a frozen pixel — either the stale drag-release pixel from coords() (freshly docked) or the stored percent mapped once at mount (reload-docked). Shrinking the window left the tab fixed-positioned outside the new viewport, so a mouse user who docked near the bottom/side and then shrank the window lost all mouse access to the devtools until reload or Ctrl+~.

Fix (packages/devtools/src/components/trigger.tsx):

  • Added a viewportTick signal bumped on resize while docked, since the viewport is read through plain DOM (documentElement.clientWidth/Height) and is otherwise non-reactive.
  • edgeTabStyle now reads viewportTick() on the docked branch so it re-runs on resize, and prefers the viewport-size-agnostic stored percent over the stale coords() pixel while docked — matching the reload-docked path the bug report identifies as the self-healing case. The mid-drag preview branch still uses coords() so the preview keeps tracking the cursor.
  • The resize effect no longer early-returns when docked; it bumps viewportTick instead. The undocked path (placeFromSettings from the stored percent) is unchanged.

This mirrors the approach the undocked floating trigger already uses (store the spot as a percent, remap on every resize from TanStack#529), extended to the docked tab.

✅ 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

  • Unit/component tests (packages/devtools/src/components/trigger.test.tsx): added 9 tests covering both dock flavors (freshly docked via drag-release and reload-docked from persisted settings) and both edge axes (vertical right and horizontal bottom), plus the across-resize percent round-trip, no-op resize idempotency, the dock→resize→undock recovery path, and no-regression coverage for the undocked floating trigger resize and the mid-drag edge preview. The full file passes 49/49; the full @tanstack/devtools library suite passes 379/379. Bug-inversion confirmed: the 4 docked-resize tests fail without the source fix (the 5 no-regression tests pass without it).
  • End-to-end (e2e/apps/solid/tests/trigger-dock-resize.spec.ts, new Playwright test in the existing solid e2e app): drives a real Chromium browser — drags the floating trigger to dock against the right edge, shrinks the viewport to 400px tall, asserts the docked tab's bounding box is fully inside the new viewport and still anchored to the right edge, then clicks the tab and asserts the devtools panel opens. Passes with the fix; bug-inversion confirmed end-to-end (without the fix the tab sits at y≈712 in the 400px viewport, fully off-screen). The existing solid.spec.ts trigger-click → panel-open test still passes — 2/2 in the solid e2e suite.
  • Routine checks: tsc (strict), eslint ./src, prettier --check, tsup build, publint --strict, and size-limit (dist/index.js = 65.61 KB ≤ 66 KB) all pass.

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