From 6206e55b963a7612226d1f797e30f7ec9e614674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C5=ABdolfs=20O=C5=A1i=C5=86=C5=A1?= Date: Fri, 6 Dec 2024 12:16:50 +0100 Subject: [PATCH] Fix issue scrolled to the bottom on navigation If the issue with comments is taller than the viewport then the focus on the comment reply at the bottom of it would cause the page to be scrolled to the end when navigating from the issue list. We want to always open the issue page at the top, this fixes it. --- src/views/repo/Issue.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/views/repo/Issue.svelte b/src/views/repo/Issue.svelte index f055a4b..c9780e3 100644 --- a/src/views/repo/Issue.svelte +++ b/src/views/repo/Issue.svelte @@ -64,6 +64,7 @@ let updatedTitle = $state(""); let labelSaveInProgress: boolean = $state(false); let assigneesSaveInProgress: boolean = $state(false); + let focusReply: boolean = $state(false); $effect(() => { // The component doesn't get destroyed when we switch between different @@ -77,6 +78,7 @@ topLevelReplyOpen = false; editingTitle = false; updatedTitle = issue.title; + focusReply = false; }); const project = $derived(repo.payloads["xyz.radicle.project"]!); @@ -132,6 +134,7 @@ behavior: "smooth", block: "center", }); + focusReply = true; } async function reload() { @@ -541,7 +544,7 @@ (topLevelReplyOpen = false)