fix(bulk-upload): no layout shift, no autofocus on date field

Replace JS navHeight measurement with CSS var(--header-height) so the fixed
panel renders in its final position on first paint — no onMount shift.

Add autofocus prop to WhoWhenSection (default true, preserves document-edit
behaviour) and pass autofocus={false} from BulkDocumentEditLayout so the date
field does not steal focus before the user has even dropped any files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-24 19:32:23 +02:00
committed by marcel
parent c1b221412f
commit 01a8654347
2 changed files with 8 additions and 11 deletions

View File

@@ -16,7 +16,8 @@ let {
initialLocation = '',
initialSenderName = '',
suggestedDateIso = '',
suggestedSenderName = ''
suggestedSenderName = '',
autofocus = true
}: {
senderId?: string;
selectedReceivers?: Person[];
@@ -26,6 +27,7 @@ let {
initialSenderName?: string;
suggestedDateIso?: string;
suggestedSenderName?: string;
autofocus?: boolean;
} = $props();
let dateDisplay = $state(untrack(() => isoToGerman(initialDateIso)));
@@ -69,7 +71,7 @@ $effect(() => {
oninput={handleDateInput}
placeholder={m.form_placeholder_date()}
maxlength="10"
autofocus={!initialDateIso}
autofocus={autofocus && !initialDateIso}
class="block w-full rounded border border-line p-2 text-sm shadow-sm
{dateInvalid ? 'border-red-400 focus:outline-none focus-visible:ring-2 focus-visible:ring-red-500' : 'focus:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring'}"
aria-describedby={dateInvalid ? 'date-error' : undefined}
@@ -89,7 +91,7 @@ $effect(() => {
bind:value={senderId}
initialName={initialSenderName}
suggestedName={suggestedSenderName}
autofocus={!!initialDateIso}
autofocus={autofocus && !!initialDateIso}
/>
</div>