From a7200dbff7f38c19e9e0f31f786e56ba9fa4565d Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 10 Nov 2026 16:38:27 +0100 Subject: fix: swiping between tabs works on the tablet #tab-body scrolls, so Chrome claimed every moving finger as a pan and sent pointercancel, and the shell dropped the swipe before pointerup: it never worked on touch. touch-action: pan-y keeps vertical scrolling the browser's and sideways moves the page's. Swipes may now also start on buttons (most of the Windows tab is cards); only sliders and the dashboard's drag and resize handles keep theirs, and a recognised swipe swallows the click it ends in. Checked with adb swipes: empty space and a window card both change tab, the card's window is not focused, and vertical scrolling still works. Also hide the OBS tab's empty blocks while OBS is off: .deck-cols set display: grid, which overrode their hidden attribute. Co-Authored-By: Claude Opus 5.5 --- static/app.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'static/app.js') diff --git a/static/app.js b/static/app.js index 61e094b..8c6d4e2 100644 --- a/static/app.js +++ b/static/app.js @@ -298,12 +298,16 @@ function stepTab(dir) { if (at !== -1 && next >= 0 && next < names.length) showTab(names[next]); } -// Swipe the content sideways to change tab; gestures on sliders and buttons -// (including the card drag handles) are theirs, not the shell's. +// Swipe the content sideways to change tab, from anywhere but sliders and +// the dashboard's drag and resize handles, whose sideways drags are theirs. +// #tab-body is `touch-action: pan-y`: otherwise the browser claims the moving +// finger as a pan and sends pointercancel, which is why swipes never worked. +// A swipe that started on a button must not also click it. let swipe = null; +let swallowClick = false; tabBody.addEventListener("pointerdown", (e) => { if (e.pointerType === "mouse" && e.buttons !== 1) return; - if (e.target.closest("input, select, textarea, button")) { + if (e.target.closest("input, select, textarea, .panel-drag, .ui-resizable-handle")) { swipe = null; return; } @@ -315,8 +319,13 @@ tabBody.addEventListener("pointerup", (e) => { const dy = e.clientY - swipe.y; swipe = null; if (Math.abs(dx) < 70 || Math.abs(dx) < Math.abs(dy) * 1.5) return; + swallowClick = true; + setTimeout(() => { swallowClick = false; }, 0); stepTab(dx < 0 ? 1 : -1); }); +tabBody.addEventListener("click", (e) => { + if (swallowClick) { e.stopPropagation(); e.preventDefault(); } +}, true); tabBody.addEventListener("pointercancel", () => { swipe = null; }); // theme.css is rendered per request from UDT's live files, so re-reading it -- cgit v1.2.3