Skip to content

feat(web): adopt vite 8.1 / sveltekit 2.70 + fix pane pop focus regression#1001

Merged
xarmian merged 1 commit into
mainfrom
feat/adopt-kit270-with-focus-fix
Jul 22, 2026
Merged

feat(web): adopt vite 8.1 / sveltekit 2.70 + fix pane pop focus regression#1001
xarmian merged 1 commit into
mainfrom
feat/adopt-kit270-with-focus-fix

Conversation

@xarmian

@xarmian xarmian commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Why

Completes the deferred toolchain upgrade from BUG-2278. PR #997's npm audit fix had dragged this toolchain in as caret collateral; #999 reverted it because it regressed the pane-focus E2E suite. This lands the upgrade with the root-cause fix so the toolchain and the fix ship together.

Root cause (confirmed: repro + parallel analysis + adversarial verify)

The trigger is @sveltejs/kit 2.66.0 (PR #15452), not vite/rolldown/svelte. Kit 2.66 blurs the active element to <body> before the component update during navigation. On the pane's popstate pop path (handlePaneBackhistory.go(-1), which can't carry keepFocus), that early blur fires only focusout (no focusin), so Kit's end-of-nav reset_focus() body.focus() becomes a no-op that emits no focusin — starving PaneHost's focusin-only backstop, which pre-2.66 piggybacked on that incidental focusin(body) to pull focus back into the pane. Focus strands on <body>. The drill path uses goto({keepFocus:true}) and is unaffected — which is exactly why only the 5 pop/ESC focus tests failed.

Fix

Re-assert focusPaneRegion() after the popstate settles (next frame, so it runs after Kit's microtask-scheduled reset_focus), removing the dependency on an incidental focusin(body). ~12 lines in paneHostController.ts; no-op when the pane closed or focus already landed in-pane.

Toolchain

vite 8.0.11→8.1.5, @sveltejs/kit 2.59.1→2.70.1, rolldown rc.18→1.1.5 — lockfile only; package.json caret ranges + advisory overrides unchanged. Advisory deps stay patched (npm audit --omit=dev = 0 vulns).

Verification

  • The 5 previously-failing pane-focus tests now pass on the bumped toolchain; local repro: reverted 28/28 → bumped (no fix) same 5 fail 2× → bumped + fix 28/28 (incl. the adversarial guard :998).
  • Full pane e2e: 41 passed. The one flaky test (:160) is a pre-existing flake on main — it flakes on the reverted toolchain too and passes on retry; not introduced here.
  • npm ci (in sync), check:tiptap-pins, npm audit --omit=dev (0 prod vulns), build, check (0 errors), test (464) — all green.
  • Independent Codex review: CLEAN (verified against SvelteKit's reset_focus internals).

Closes BUG-2278.

https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra

…ocus

Completes the deferred upgrade from BUG-2278. The advisory-fix PR #997 had
dragged this toolchain in via `npm audit fix`; #999 reverted it because it
regressed the pane-focus E2E suite. Root-caused (see BUG-2278 residual): the
trigger is @sveltejs/kit 2.66.0 (PR #15452), which blurs the active element
to <body> BEFORE the component update during navigation. On the pane's
popstate pop path (handlePaneBack -> history.go(-1), which can't carry
keepFocus), that early blur (focusout only, no focusin) makes Kit's end-of-nav
reset_focus() body.focus() a no-op emitting no focusin — starving PaneHost's
focusin-only backstop, so focus strands on <body>. (Drill path uses
goto({keepFocus:true}) and is unaffected — which is why only the 5 pop/ESC
focus tests failed. vite/rolldown/svelte are not implicated.)

Fix: re-assert focusPaneRegion() after the popstate settles (next frame, so
it runs after Kit's microtask-scheduled reset_focus), removing the dependency
on an incidental focusin(body). ~12 lines in paneHostController.ts; no-op when
the pane closed or focus already landed in-pane.

Toolchain: vite 8.0.11->8.1.5, @sveltejs/kit 2.59.1->2.70.1, rolldown
rc.18->1.1.5 (lockfile only; package.json caret ranges + advisory overrides
unchanged). Advisory deps stay at their patched versions (audit 0 prod vulns).

Verified on the bumped toolchain: the 5 previously-failing pane-focus tests
pass, full pane e2e 41 passed (the one flaky test, :160, is a PRE-EXISTING
flake on main that flakes on the reverted toolchain too and passes on retry),
web check (0 errors), test (464), build, tiptap-pins, npm ci all green.

Claude-Session: https://claude.ai/code/session_01EZ6yr6pAUFb1uffan912ra
@xarmian
xarmian merged commit add3ffa into main Jul 22, 2026
6 checks passed
@xarmian
xarmian deleted the feat/adopt-kit270-with-focus-fix branch July 22, 2026 02:58
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.

1 participant