Skip to content

Conversation

@teemingc
Copy link
Member

@teemingc teemingc commented Jun 6, 2025

This PR fixes a regression caused by #10856 that didn't take hash routing into account when trying to set the sequential focus navigation starting point. It now correctly determines the hash and uses a cleaner fix than before with element.focus() instead of location.replace (although used in a bit of a hacky way but not anymore hacky than the previous PR).

I've tested on Chrome and Firefox on Windows but will need to test this on Safari too. Maybe CI can do that for me. .focus() does not work on Safari and Firefox Ubuntu 😄


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

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

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.

@changeset-bot
Copy link

changeset-bot bot commented Jun 6, 2025

🦋 Changeset detected

Latest commit: 71ac4d4

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

* @returns {string}
*/
function get_id(url) {
return decodeURIComponent(app.hash ? (url.hash.split('#')[2] ?? '') : url.hash.slice(1));
Copy link
Member

Choose a reason for hiding this comment

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

is url hash formatted like https://example.com/#<apphash>#<otherhash> ?

in that case, is it sure that apphash and otherhash both can't contain # char?

otherwise it would be better to take app.hash and remove it from the beginning of url hash if it is there 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I could've sworn we have a similar function already (I haven't looked closer yet though)

@teemingc teemingc marked this pull request as draft June 9, 2025 01:53
@teemingc teemingc closed this Jun 12, 2025
@teemingc
Copy link
Member Author

Closed in favour of #13884

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.

4 participants