-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: defer when clicking hash links with data-sveltekit-reload (#12866)
fixes #12582 fixes #12188 This PR ensures that clicking on a hash link with the reload option avoids the usual behaviour of thinking the page will reload and instead allows it to be handled as if the option wasn't enabled (hash links on the same page never reload the page). It also fixes a behaviour where an element doesn't get focused when clicking on the hash link more than once. --------- Co-authored-by: Simon H <[email protected]>
- Loading branch information
1 parent
bcb30cd
commit 5006435
Showing
7 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sveltejs/kit': patch | ||
--- | ||
|
||
fix: ensure element is focused after subsequent clicks of the same hash link |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@sveltejs/kit': patch | ||
--- | ||
|
||
fix: avoid reloading behaviour for hash links with data-sveltekit-reload if the hash is on the same page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/kit/test/apps/basics/src/routes/data-sveltekit/reload/hash/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<a href="#example" data-sveltekit-reload>focus</a> | ||
<input id="example" /> | ||
<a href="/data-sveltekit/reload/hash/new">new page</a> |
1 change: 1 addition & 0 deletions
1
packages/kit/test/apps/basics/src/routes/data-sveltekit/reload/hash/new/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p>hello world</p> |
2 changes: 2 additions & 0 deletions
2
packages/kit/test/apps/basics/src/routes/routing/hashes/focus/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<a href="#example">focus</a> | ||
<input id="example" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters