Skip to content

Commit 4b41e0f

Browse files
author
kirbIndustries
authored
Update index.js
1 parent c8e299c commit 4b41e0f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

js/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14153,12 +14153,15 @@ function setupDrawerInteractions() {
1415314153
}
1415414154
});
1415514155

14156+
// Track global touch time to prevent ghost clicks safely across all scopes
14157+
window.addEventListener('touchstart', () => { window.lastTouchTime = Date.now(); }, { capture: true, passive: true });
14158+
1415614159
// Mouse Events for regular drawer interaction
1415714160
document.addEventListener('mousedown', (e) => {
1415814161
if (oneButtonNavEnabled) return;
1415914162
if (e.button !== 0) return;
1416014163
// Prevent ghost duplicate clicks when using a touchscreen
14161-
if (Date.now() - lastTouchTime < 500) return;
14164+
if (Date.now() - (window.lastTouchTime || 0) < 500) return;
1416214165

1416314166
const element = document.elementFromPoint(e.clientX, e.clientY);
1416414167

@@ -14179,9 +14182,9 @@ function setupDrawerInteractions() {
1417914182
if (oneButtonNavEnabled) return;
1418014183
// Prevent ghost duplicate clicks when using a touchscreen
1418114184
// (Browsers fire mouseup a few milliseconds after touchend)
14182-
if (Date.now() - lastTouchTime < 500) return;
14185+
if (Date.now() - (window.lastTouchTime || 0) < 500) return;
1418314186

14184-
if (isDragging) {
14187+
if (isDragging) {
1418514188
let isTap = false;
1418614189
const deltaX = Math.abs(e.clientX - startX);
1418714190
const deltaY = Math.abs(e.clientY - startY);

0 commit comments

Comments
 (0)