From 9cc2a1811b2b7e18ff3fb4e7122e6d915a503b93 Mon Sep 17 00:00:00 2001 From: Manjunath Paparaju Date: Fri, 13 Nov 2026 10:52:37 +0530 Subject: [PATCH] Leave at least half a second between edge-scroll steps A scroll that would step a rail again within 500 ms of the last step is used up without stepping, so panels never switch back to back. Co-authored-by: Sameh Khamis --- src/ui/railEdgeScroll.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ui/railEdgeScroll.js b/src/ui/railEdgeScroll.js index cf46ef02f..c66b461ab 100644 --- a/src/ui/railEdgeScroll.js +++ b/src/ui/railEdgeScroll.js @@ -16,6 +16,12 @@ const STEP_DELTA = 40; const GESTURE_GAP_MS = 180; /** After a step, how long (ms) before the same motion can count as a new flick. */ const STEP_COOLDOWN_MS = 220; +/** + * The least time (ms) between two steps, whatever the wheel does. A motion + * that would step sooner is used up without stepping, so panels never switch + * back to back. + */ +const STEP_GAP_MS = 500; /** A wheel event this large (pixels) is a mouse wheel notch, not a trackpad. */ const NOTCH_DELTA = 100; /** The widest the strip gets, measured from the screen edge, whatever shape the rail takes. */ @@ -227,6 +233,7 @@ export function installRailEdgeScroll(doc = globalThis.document) { travel += event.deltaY; if (Math.abs(travel) < STEP_DELTA) return; stepped = true; + if (now - steppedAt < STEP_GAP_MS) return; steppedAt = now; step(Math.sign(travel)); }