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

@@ -1,7 +1,7 @@
<script lang="ts">
import { SvelteMap } from 'svelte/reactivity';
import { goto } from '$app/navigation';
import { onMount, onDestroy, untrack } from 'svelte';
import { onDestroy, untrack } from 'svelte';
import { m } from '$lib/paraglide/messages.js';
import BulkDropZone from './BulkDropZone.svelte';
import FileSwitcherStrip from './FileSwitcherStrip.svelte';
@@ -27,12 +27,6 @@ let {
initialReceivers?: Person[];
} = $props();
// --- Layout ---
let navHeight = $state(0);
onMount(() => {
navHeight = document.querySelector('header')?.getBoundingClientRect().height ?? 0;
});
// --- File state ---
let files = new SvelteMap<string, FileEntry>();
let activeId = $state<string | null>(null);
@@ -124,7 +118,7 @@ async function save() {
}
</script>
<div class="fixed inset-x-0 bottom-0 flex flex-col" style="top: {navHeight}px">
<div class="fixed inset-x-0 bottom-0 flex flex-col" style="top: var(--header-height)">
<!-- Topbar -->
<div class="flex shrink-0 items-center gap-3 border-b border-line bg-surface px-6 py-3">
<a
@@ -226,6 +220,7 @@ async function save() {
bind:selectedReceivers={selectedReceivers}
bind:dateIso={dateIso}
initialSenderName={initialSenderName}
autofocus={false}
/>
<DescriptionSection bind:tags={tags} hideTitle />
</ScopeCard>