From ab7e745cc9abd592aa631bffb35880221e7ac89c Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Thu, 2 Nov 2023 08:42:14 -0400 Subject: [PATCH] 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 --------- Co-authored-by: Nate Moore --- .changeset/dirty-dolls-joke.md | 5 +++++ packages/astro/src/transitions/router.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/dirty-dolls-joke.md diff --git a/.changeset/dirty-dolls-joke.md b/.changeset/dirty-dolls-joke.md new file mode 100644 index 000000000000..fc14a2a7ac3e --- /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 e0e93c845171..af8a09d97643 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 = '';