From 3d5a5839b3f2456b88a344945d4f8c3331c93aa4 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 16 Jun 2026 00:31:14 +0000 Subject: [PATCH] fix: use capture:true on touch event listeners to prevent page JS interference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Touch handlers used bubble phase (no capture:true), so any page script that called stopPropagation() on touchstart/touchend — e.g. Authelia's login form or scroll containers — silently blocked the preload's swipe detection. Using capture:true fires the preload's listeners in the capture phase (before any element-level handlers), so swipe works even on pages with their own touch handling. Applied to both preloads (standard and auto-show keyboard). Also adds missing [TOUCH] 2-finger HORIZONTAL console.log to the standard preload so swipe events are visible in electron.log for debugging. https://claude.ai/code/session_01EyjEQLWbTXcZgbMDarf7NU --- ubuntu-based-kiosk-v1.0.2.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ubuntu-based-kiosk-v1.0.2.sh b/ubuntu-based-kiosk-v1.0.2.sh index eeee051..f46815f 100644 --- a/ubuntu-based-kiosk-v1.0.2.sh +++ b/ubuntu-based-kiosk-v1.0.2.sh @@ -7172,8 +7172,8 @@ window.addEventListener('DOMContentLoaded',()=>{ touchStartTime=Date.now(); fingerCount=e.touches.length; } - },{passive:true}); - + },{passive:true,capture:true}); + document.addEventListener('touchend',e=>{ if(e.changedTouches.length>=1){ const touchEndX=e.changedTouches[0].clientX; @@ -7181,9 +7181,9 @@ window.addEventListener('DOMContentLoaded',()=>{ const deltaX=touchEndX-touchStartX; const deltaY=touchEndY-touchStartY; const deltaTime=Date.now()-touchStartTime; - + if(deltaTime>SWIPE_MAX_TIME)return; - + const absX=Math.abs(deltaX); const absY=Math.abs(deltaY); @@ -7194,6 +7194,7 @@ window.addEventListener('DOMContentLoaded',()=>{ } // 2-finger HORIZONTAL = change tabs else if(fingerCount===2&&absX>SWIPE_THRESHOLD&&absY0?'swipe-right':'swipe-left'); } // 1-finger HORIZONTAL = arrow keys @@ -7207,7 +7208,7 @@ window.addEventListener('DOMContentLoaded',()=>{ }); } } - },{passive:true}); + },{passive:true,capture:true}); // Show pause button on user interaction (for rotation sites only) let lastUserInteraction=0; @@ -9188,8 +9189,8 @@ window.addEventListener('DOMContentLoaded',()=>{ touchStartTime=Date.now(); fingerCount=e.touches.length; } - },{passive:true}); - + },{passive:true,capture:true}); + document.addEventListener('touchend',e=>{ if(e.changedTouches.length>=1){ const touchEndX=e.changedTouches[0].clientX; @@ -9197,9 +9198,9 @@ window.addEventListener('DOMContentLoaded',()=>{ const deltaX=touchEndX-touchStartX; const deltaY=touchEndY-touchStartY; const deltaTime=Date.now()-touchStartTime; - + if(deltaTime>SWIPE_MAX_TIME)return; - + const absX=Math.abs(deltaX); const absY=Math.abs(deltaY); @@ -9231,7 +9232,7 @@ window.addEventListener('DOMContentLoaded',()=>{ }); } } - },{passive:true}); + },{passive:true,capture:true}); // Optional: Auto-show on text field focus (can be disabled) let autoShowEnabled = true; // Set to false to disable auto-show