From 6cbfedd013cf7b1d434022f8c25f4d01647aab03 Mon Sep 17 00:00:00 2001 From: Sandro Date: Thu, 29 Oct 2026 17:28:43 +0100 Subject: [PATCH] fix(lists): typing into the shopping list on phones The + button and the menu entry focused the new-item field 60 ms after the tap; iOS only opens the keyboard for focus() inside the user gesture, so the field was selected but nothing could be typed. Focus now happens right in the tap. The list inputs use 16px on phones, so iOS no longer zooms in and pushes the field under the keyboard. Version 0.5.2. Co-Authored-By: Claude Opus 5.5 --- frontend/package-lock.json | 4 +-- frontend/package.json | 2 +- .../src/features/lists/SharedListsView.tsx | 25 ++++++++++--------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 1cd3571..797b752 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "mindsift-frontend", - "version": "0.5.1", + "version": "0.5.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mindsift-frontend", - "version": "0.5.1", + "version": "0.5.2", "license": "Unlicense", "dependencies": { "@types/prismjs": "^1.26.6", diff --git a/frontend/package.json b/frontend/package.json index 33c9558..a764fec 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "mindsift-frontend", "private": true, - "version": "0.5.1", + "version": "0.5.2", "license": "Unlicense", "type": "module", "scripts": { diff --git a/frontend/src/features/lists/SharedListsView.tsx b/frontend/src/features/lists/SharedListsView.tsx index 964b204..a9bc9cf 100644 --- a/frontend/src/features/lists/SharedListsView.tsx +++ b/frontend/src/features/lists/SharedListsView.tsx @@ -766,13 +766,16 @@ export const SharedListsView: React.FC = ({ onRefreshGloba return result; }, [openItems]); + const focusNewItemInput = () => { + inputRef.current?.focus({ preventScroll: true }); + inputRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' }); + }; + // Register context-sensitive mobile menu groups behind the MindSift logo useEffect(() => { setPrimaryAction(() => { - setTimeout(() => { - inputRef.current?.focus(); - inputRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' }); - }, 60); + // Focus right inside the tap: iOS only opens the keyboard for focus() during the user gesture + focusNewItemInput(); }); setGroups([ @@ -786,10 +789,7 @@ export const SharedListsView: React.FC = ({ onRefreshGloba icon: , variant: 'accent', onClick: () => { - setTimeout(() => { - inputRef.current?.focus(); - inputRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' }); - }, 60); + focusNewItemInput(); }, }, { @@ -1081,7 +1081,8 @@ export const SharedListsView: React.FC = ({ onRefreshGloba setTimeout(() => setShowSuggestions(false), 200); }} placeholder={`Eintrag zu "${activeList.title}" hinzufügen (z. B. Hafermilch #Kühlregal)…`} - className="flex-1 bg-transparent py-1.5 sm:py-1 text-sm text-main placeholder-faint focus:outline-none" + // 16px on phones: iOS zooms into smaller fields and the layout jumps under the keyboard + className="flex-1 bg-transparent py-1.5 sm:py-1 text-base sm:text-sm text-main placeholder-faint focus:outline-none" /> {/* Hashtag Autocomplete Suggestions Dropdown */} @@ -1125,7 +1126,7 @@ export const SharedListsView: React.FC = ({ onRefreshGloba value={newItemQty} onChange={(e) => setNewItemQty(e.target.value.replace(/[^0-9.,xX]/g, ''))} placeholder="Menge (z.B. 2)" - className="flex-1 sm:flex-none sm:w-28 h-9 sm:h-7 px-2.5 sm:px-2 input-field text-xs" + className="flex-1 sm:flex-none sm:w-28 h-11 sm:h-7 px-2.5 sm:px-2 input-field text-base sm:text-xs" />