Skip to content

fix: avoid empty getElementById() call on hash routing navigation - #16448

Merged
elliott-with-the-longest-name-on-github merged 2 commits into
sveltejs:version-3from
Nic-Polumeyv:fix-hash-empty-anchor-lookup
Jul 20, 2026
Merged

elliott-with-the-longest-name-on-github merged 2 commits into
sveltejs:version-3from
Nic-Polumeyv:fix-hash-empty-anchor-lookup

Conversation

@Nic-Polumeyv

Copy link
Copy Markdown
Member

closes #14956

reset_focus already guards the empty id, navigate didn't. Both lookups now share one guarded helper. The test asserts on the call itself since the warning only exists in Firefox.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

ghost commented Jul 20, 2026 •

Copy link
Copy Markdown

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

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

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

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

ghost commented Jul 20, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f9de77a

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

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, will merge when tests all turn green

@ghost
ghost merged commit bfe4dea into sveltejs:version-3 Jul 20, 2026
@ghost ghost mentioned this pull request Jul 20, 2026
@ghost
ghost deleted the fix-hash-empty-anchor-lookup branch July 30, 2026 22:53
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.

Hash router logs “Empty string passed to getElementById()” on navigation

2 participants