Skip to content
This repository was archived by the owner on Nov 25, 2024. It is now read-only.

Commit 1462fbe

Browse files
authored
fix: prevent Nav flickering on mobile (#164)
Firefox for Android occasionally emits multiple scroll events with the same `scrollTop` integer value towards the end of an inertia scroll, which causes the Nav to flicker between visible states. This fixes it by keeping the visible state the same if `scrollTop` is unchanged.
1 parent 202903c commit 1462fbe

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

.changeset/yellow-islands-pump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/site-kit': patch
3+
---
4+
5+
Fix nav flickering on mobile

packages/site-kit/src/lib/nav/Nav.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ Top navigation bar for the application. It provides a slot for the left side, th
3737
3838
const scroll = root_scroll_element.scrollTop;
3939
if (!hash_changed) {
40-
visible = scroll < 50 || scroll < last_scroll;
40+
visible = scroll === last_scroll
41+
? visible
42+
: scroll < 50 || scroll < last_scroll;
4143
}
4244
4345
last_scroll = scroll;

0 commit comments

Comments
 (0)