From 513a7290b0f011a77ba200d53d8fd21613887714 Mon Sep 17 00:00:00 2001 From: Marcel Date: Fri, 20 Mar 2026 18:32:37 +0100 Subject: [PATCH] fix(conversations): keep swap button in DOM to prevent grid column width shift The swap button was conditionally removed from the DOM with {#if}, which caused the receiver input to collapse into the narrow auto column of the grid-cols-[1fr_auto_1fr] layout on desktop when no persons were selected. The button is now always rendered. On desktop it becomes invisible (visibility:hidden) when no persons are selected, preserving the middle column width so both 1fr columns stay equal. On mobile it remains hidden (display:none) via the hidden class so no empty gap appears between the stacked inputs. Co-Authored-By: Claude Sonnet 4.6 --- .../src/routes/conversations/+page.svelte | 53 ++++++++++--------- .../routes/conversations/page.svelte.spec.ts | 7 +-- 2 files changed, 32 insertions(+), 28 deletions(-) diff --git a/frontend/src/routes/conversations/+page.svelte b/frontend/src/routes/conversations/+page.svelte index 9cb882f0..8467a3b2 100644 --- a/frontend/src/routes/conversations/+page.svelte +++ b/frontend/src/routes/conversations/+page.svelte @@ -91,32 +91,35 @@ const enrichedDocuments = $derived( /> - - {#if senderId && receiverId} -
- -
- {/if} + + + {m.conv_swap_btn()} + +
{ await expect.element(page.getByText(/Wählen Sie zwei Personen aus/i)).toBeInTheDocument(); }); - it('does not show the swap button when no persons are selected', async () => { + it('hides the swap button when no persons are selected', async () => { render(Page, { data: baseData }); - await expect.element(page.getByTestId('conv-swap-btn')).not.toBeInTheDocument(); + // Button is always in the DOM (holds grid column width on desktop) but made invisible + await expect.element(page.getByTestId('conv-swap-btn')).toHaveClass('invisible'); }); it('does not show the new document link when no persons are selected', async () => { @@ -76,7 +77,7 @@ describe('Conversations page – no results', () => { describe('Conversations page – swap button', () => { it('shows the swap button when both persons are selected', async () => { render(Page, { data: withPersons }); - await expect.element(page.getByTestId('conv-swap-btn')).toBeInTheDocument(); + await expect.element(page.getByTestId('conv-swap-btn')).not.toHaveClass('invisible'); }); it('calls goto with swapped sender and receiver when clicked', async () => {