summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2023-11-02 08:42:14 -0400
committerGravatar GitHub <noreply@github.com> 2023-11-02 08:42:14 -0400
commitab7e745cc9abd592aa631bffb35880221e7ac89c (patch)
tree1d1e9ee8c2c504e355f5f131fc5ffcb9b839f1aa
parent74fa4adba0b51bcaa293483ac93bd6a71f8678d2 (diff)
downloadastro-ab7e745cc9abd592aa631bffb35880221e7ac89c.tar.gz
astro-ab7e745cc9abd592aa631bffb35880221e7ac89c.tar.zst
astro-ab7e745cc9abd592aa631bffb35880221e7ac89c.zip
Increase the scroll restoration throttle time (#8981)
* Increase the scroll restoration throttle time * Add changeset * Update packages/astro/src/transitions/router.ts Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> --------- Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
-rw-r--r--.changeset/dirty-dolls-joke.md5
-rw-r--r--packages/astro/src/transitions/router.ts2
2 files changed, 6 insertions, 1 deletions
diff --git a/.changeset/dirty-dolls-joke.md b/.changeset/dirty-dolls-joke.md
new file mode 100644
index 000000000..fc14a2a7a
--- /dev/null
+++ b/.changeset/dirty-dolls-joke.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Increase the scroll restoration throttle time
diff --git a/packages/astro/src/transitions/router.ts b/packages/astro/src/transitions/router.ts
index e0e93c845..af8a09d97 100644
--- a/packages/astro/src/transitions/router.ts
+++ b/packages/astro/src/transitions/router.ts
@@ -515,7 +515,7 @@ if (inBrowser) {
addEventListener('popstate', onPopState);
addEventListener('load', onPageLoad);
if ('onscrollend' in window) addEventListener('scrollend', onScroll);
- else addEventListener('scroll', throttle(onScroll, 300));
+ else addEventListener('scroll', throttle(onScroll, 350), { passive: true });
}
for (const script of document.scripts) {
script.dataset.astroExec = '';