Skip to content

chore: give scroll and focus their own state and tests - #16983

Open
Nic-Polumeyv wants to merge 1 commit into
client-focus-modulefrom
client-focus-design
Open

chore: give scroll and focus their own state and tests#16983
Nic-Polumeyv wants to merge 1 commit into
client-focus-modulefrom
client-focus-design

Conversation

@Nic-Polumeyv

@Nic-Polumeyv Nic-Polumeyv commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

On top of #16980: scroll.js owns the after-navigation scroll and focus.js owns the blur and the focus reset, with finish_navigation the one place that sequences them. Whether the app moved focus during the update is now read from document.activeElement directly instead of a snapshot taken before the update, and a navigation that does not reset no longer scrolls to where it already is.

A focused SVG element is now blurred before the DOM update like any HTML element.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Aug 31, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from b75501c:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/b75501c942eed30d2fea877c85f2855230e4cd56

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16983

@changeset-bot

changeset-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b75501c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

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

@svelte-docs-bot

Copy link
Copy Markdown

@Nic-Polumeyv
Nic-Polumeyv force-pushed the client-focus-design branch 2 times, most recently from 8081c8a to 889a452 Compare September 1, 2026 18:34
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: QUIET

Plan: Advanced

Run ID: 049b776c-944a-40ff-baca-6b9e0e6e4611

📥 Commits

Reviewing files that changed from the base of the PR and between fad9a52 and b75501c.

📒 Files selected for processing (7)
  • .changeset/blur-svg-focus.md
  • packages/kit/src/runtime/client/client.js
  • packages/kit/src/runtime/client/focus.js
  • packages/kit/src/runtime/client/focus.spec.js
  • packages/kit/src/runtime/client/scroll.js
  • packages/kit/src/runtime/client/scroll.spec.js
  • packages/kit/src/runtime/client/utils.js
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • sveltejs/vite-plugin-svelte (manual)
  • vitejs/vite (manual)
  • sveltejs/svelte (manual)

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The navigation runtime now restores scroll independently from focus. restore_scroll handles history coordinates, hash targets, and top-of-page restoration. Focus handling now blurs focused SVG elements and tests restoration to document.body. Navigation wiring uses separate scroll and focus operations, including reload restoration updates. Hash element decoding is handled within get_hash_element. A patch Changeset documents the fix.

Merge Risk: ⚪ Minimal · up to b7550

Navigation now restores scrolling independently from focus, avoids unnecessary scrolling when focus is retained, and clears focus from SVG elements before updates. No current merge-blocking risk is evident.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required chore: prefix and accurately summarises the separation of scroll and focus state management and tests.
Backward Compatibility Impact Disclosure ✅ Passed No breaking public interface change is introduced. The diff changes internal runtime modules only. reset_scroll_and_focus and get_id were internal functions, and focus.js, scroll.js, and `util…

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/kit/src/runtime/client/client.js

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

packages/kit/src/runtime/client/focus.js

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

packages/kit/src/runtime/client/focus.spec.js

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

  • 3 others

Comment @coderabbitai help to get the list of available commands.

@teemingc
teemingc force-pushed the client-focus-design branch from 889a452 to b75501c Compare September 7, 2026 05:38
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