From 533d89befd1fe4b8134440e8d415d40a5fb7c04b Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Sat, 29 Aug 2026 21:22:36 +0000 Subject: Fix web quick-add keyboard viewport bug and shopping-mode add scroll jump DashboardActivity (the WebView-wrapped web dashboard) had no windowSoftInputMode override, unlike QuickAddActivity which already sets adjustResize|stateVisible for the same class of problem: without it, Android WebViews default to adjustPan, which shifts the whole page up behind the keyboard instead of resizing the viewport, pushing a centered `position: fixed` modal's input out of reach when the keyboard opens. shopping-mode.html's fixed-bottom quick-add bar called a plain .focus() on the item-name input right after the item list above it grew by one row. The browser's default scroll-into-view for that focus call was computed against the now-taller document and dragged the whole page to the bottom instead of leaving the always-visible fixed bar alone. preventScroll: true stops that. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B --- web/templates/shopping-mode.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'web/templates') diff --git a/web/templates/shopping-mode.html b/web/templates/shopping-mode.html index 3a1a3bc..ebcfea5 100644 --- a/web/templates/shopping-mode.html +++ b/web/templates/shopping-mode.html @@ -134,7 +134,13 @@ document.body.addEventListener('htmx:afterRequest', function(evt) { if (evt.detail.elt.id === 'quick-add-form' && evt.detail.successful) { evt.detail.elt.reset(); - evt.detail.elt.querySelector('input[name=name]').focus(); + // preventScroll: this input sits in a `position: fixed` bar pinned to the + // bottom of the viewport. #shopping-items above it just grew by one item + // (the swap that landed right before this handler runs), and a plain + // .focus() call's default scroll-into-view -- computed against the new, + // taller document -- was dragging the whole page down to the bottom + // instead of leaving the already-visible fixed bar alone. + evt.detail.elt.querySelector('input[name=name]').focus({ preventScroll: true }); evt.detail.elt.classList.add('flash-success'); setTimeout(function() { evt.detail.elt.classList.remove('flash-success'); }, 300); } -- cgit v1.2.3