Focus a text field when the edit dialog opens, never the date input

showModal() with no explicit focus autofocuses the first control — the
date input — which on iOS pops the native calendar over the form. Focus
weight/grams/note per event type instead, like openNoteDialog does.
This commit is contained in:
Alexander Heldt
2026-07-15 09:49:02 +00:00
parent 131346a7c7
commit 7cb59a7a23
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -1974,6 +1974,14 @@
}
renderEditPhotos();
editDialog.showModal();
// Without an explicit focus the browser autofocuses the first control —
// the date input — and iOS immediately pops the calendar over the form.
// Land on the first relevant text field instead (same trick and delay as
// openNoteDialog: synchronous focus can be lost while the dialog settles).
const focusTarget = !editWeightField.hidden ? editWeight
: !editGramsField.hidden ? editGrams
: editNote;
setTimeout(() => focusTarget.focus(), 50);
}
editPhotoBtn.addEventListener("click", () => editPhotoInput.click());
+1
View File
@@ -1,4 +1,5 @@
[
{ "date": "2026-07-15", "text": "Editing an event no longer pops the date picker over the whole screen on iPhone" },
{ "date": "2026-07-15", "text": "Weight and amount fields no longer show up on events that don't use them (e.g. editing a pee)" },
{ "date": "2026-07-15", "text": "The date in the top bar is shorter (no year), so the whole bar fits on smaller iPhones" },
{ "date": "2026-07-13", "text": "The big timer is back at the top — scroll past it and it hops into the frozen bar instead" },