-
-
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.
* Capture scroll position when using `pushState` * Added test * Format * Added changeset * Update .changeset/healthy-windows-rush.md Co-authored-by: Ben McCann <[email protected]> * move test * lint --------- Co-authored-by: Patrick <[email protected]> Co-authored-by: Patrick <[email protected]> Co-authored-by: Ben McCann <[email protected]> Co-authored-by: Rich Harris <[email protected]>
- Loading branch information
1 parent
0679801
commit 129a9a3
Showing
5 changed files
with
43 additions
and
0 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: capture scroll position when using `pushState` |
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
20 changes: 20 additions & 0 deletions
20
packages/kit/test/apps/basics/src/routes/scroll/push-state/+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,20 @@ | ||
<script> | ||
import { pushState } from '$app/navigation'; | ||
import { page } from '$app/stores'; | ||
function handleClick() { | ||
pushState('', { active: true }); | ||
} | ||
</script> | ||
|
||
<a id="subpage-link" href="/scroll/push-state/a">Subpage</a> | ||
|
||
{#each { length: 20 } as _, n} | ||
<p>#{n}</p> | ||
{/each} | ||
|
||
<button id="shallow-button" type="button" on:click={handleClick}>Shallow</button> | ||
|
||
{#if $page.state.active} | ||
<button id="back-button" type="button" on:click={() => history.back()}>Back</button> | ||
{/if} |
1 change: 1 addition & 0 deletions
1
packages/kit/test/apps/basics/src/routes/scroll/push-state/a/+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 @@ | ||
<button id="back-button" type="button" on:click={() => history.back()}>Back</button> |
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