From f4ab2544ae758ace77e07415e26b7bca826a01bb Mon Sep 17 00:00:00 2001 From: Brandon Oxendine Date: Tue, 18 Aug 2026 18:14:23 +0200 Subject: [PATCH] Keep the patch description open while editing The description collapses past 300px behind a show more toggle, which also applied to the editor that replaces it. Half of what was being written could be cut off, with a control offering to hide more of it. Editing state moves from the revision component to a bindable prop, so the patch view that owns the collapse can see it. --- src/components/Revision.svelte | 6 ++++-- src/views/repo/Patch.svelte | 10 +++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/Revision.svelte b/src/components/Revision.svelte index fd15807ed..2e1c80a9d 100644 --- a/src/components/Revision.svelte +++ b/src/components/Revision.svelte @@ -103,6 +103,9 @@ // revision list can be marked, not just the selected one. draftRevisionIds?: string[]; showingRevisionDiff?: boolean; + // Whether the description is being edited, so the view around it can keep + // it open rather than collapsing what is being typed. + editingDescription?: boolean; // Review ids (and `STANDALONE_COMMENTS`) whose code comments are // hidden from the diff. hiddenCommentSources?: string[]; @@ -132,6 +135,7 @@ draftReviewId, draftRevisionIds = [], showingRevisionDiff = $bindable(true), + editingDescription = $bindable(false), hiddenCommentSources = [], filesExpanded = $bindable(true), onViewChanges, @@ -1017,8 +1021,6 @@ }) as Thread[], ); - let editingDescription = $state(false); - async function editRevision( description: string, embeds: Embed[], diff --git a/src/views/repo/Patch.svelte b/src/views/repo/Patch.svelte index 41d123332..891c5f5e4 100644 --- a/src/views/repo/Patch.svelte +++ b/src/views/repo/Patch.svelte @@ -282,8 +282,11 @@ let descriptionExpanded = $state(false); let descriptionEl = $state(); let descriptionOverflows = $state(false); + let descriptionEditing = $state(false); + // Editing keeps the description open: collapsing it would hide part of what + // is being written, and the height is the editor's rather than the text's. const descriptionCollapsed = $derived( - descriptionOverflows && !descriptionExpanded, + descriptionOverflows && !descriptionExpanded && !descriptionEditing, ); $effect(() => { const el = descriptionEl; @@ -1578,9 +1581,10 @@ {loadPatch} revision={revisions[0]} {config} - view="description" /> + view="description" + bind:editingDescription={descriptionEditing} /> - {#if descriptionOverflows} + {#if descriptionOverflows && !descriptionEditing}