diff options
| -rw-r--r-- | android/app/src/main/AndroidManifest.xml | 3 | ||||
| -rw-r--r-- | web/templates/shopping-mode.html | 8 |
2 files changed, 9 insertions, 2 deletions
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 58a6062..6795fb6 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -41,7 +41,8 @@ <activity android:name=".ui.DashboardActivity" android:exported="true" - android:theme="@style/Theme.Dashboard"> + android:theme="@style/Theme.Dashboard" + android:windowSoftInputMode="adjustResize"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> 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); } |
