From b9104741730c2c278394aae9659c6a1d44f5d462 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Jakse?= Date: Mon, 27 Oct 2025 08:07:20 +0100 Subject: [PATCH] Disable auto-zoom on WebKit Our usage of CSS zoom messes up D&D on WebKit because of: https://bugs.webkit.org/show_bug.cgi?id=77998 As zoom is more a nice to have, let's just disable it for WebKit and enable it for more recent versions when it gets fixed. --- public/trivabble.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/public/trivabble.js b/public/trivabble.js index 545892d..247681e 100644 --- a/public/trivabble.js +++ b/public/trivabble.js @@ -2734,6 +2734,15 @@ startGame(getSetting("GameNumber")); } + // https://rnwest.engineer/detect-webkit/ + function isWebKit() { + const ua = navigator.userAgent; + // As far as I can tell, Chromium-based desktop browsers are the only browsers + // that pretend to be WebKit-based but aren't. + return (/AppleWebKit/.test(ua) && !/Chrome/.test(ua)) || + /\b(iPad|iPhone|iPod)\b/.test(ua); + } + function initBoard() { const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; const def = BoardList[getSetting("BoardLabel")]; @@ -2813,7 +2822,10 @@ } setCellCaptions(getSetting("CELL_CAPTIONS")); - if (window.CSS && CSS.supports && CSS.supports("zoom: 1.5")) { + if (window.CSS && CSS.supports && CSS.supports("zoom: 1.5") && !isWebKit()) { + // We zoom the window so the board is as big as possible + // Except on WebKit because we are affected by the following bug, + // which fucks up d&d: https://bugs.webkit.org/show_bug.cgi?id=77998 resize(); window.removeEventListener("resize", resize); window.addEventListener("resize", resize); -- 2.30.2