From 9072b791c461863aedc85e070a59259f1d15bdaa Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 16 May 2022 23:16:01 -0700 Subject: web: overlay virtual keyboard on chrome This prevents everything from getting resized when an input field is focused. Ideally we'd make the page scrollable when the keyboard appears, but the inputs are all at the top so it's not crucial. --- web/static/dartboat.js | 3 +++ web/static/sw.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/web/static/dartboat.js b/web/static/dartboat.js index 9e97dfc..a46ffc9 100644 --- a/web/static/dartboat.js +++ b/web/static/dartboat.js @@ -199,6 +199,9 @@ document.addEventListener('keydown', e => { if ('serviceWorker' in navigator) navigator.serviceWorker.register('sw.js'); +if ('virtualKeyboard' in navigator) + navigator.virtualKeyboard.overlaysContent = true; + // disable back button when installed as a PWA. a single click exits the app, // destroying match state without confirmation, so we must resort to this. if (window.matchMedia('(display-mode: standalone)').matches) { diff --git a/web/static/sw.js b/web/static/sw.js index 3e3ccfd..a5fe6fc 100644 --- a/web/static/sw.js +++ b/web/static/sw.js @@ -1,5 +1,5 @@ const CACHE_PREFIX = 'dartboat-' -const CACHE_VERSION = '12'; +const CACHE_VERSION = '13'; const CACHE_NAME = `${CACHE_PREFIX}${CACHE_VERSION}`; const CACHE_FILES = [ -- cgit v1.2.3-70-g09d2