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.
This commit is contained in:
Rūdolfs Ošiņš
2024-12-06 12:16:50 +01:00
parent 15e2935cee
commit 6206e55b96
+4 -1
View File
@@ -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 @@
<CommentToggleInput
disallowEmptyBody
rid={repo.rid}
focus
focus={focusReply}
onexpand={toggleReply}
onclose={topLevelReplyOpen
? () => (topLevelReplyOpen = false)