Skip to content

Commit

Permalink
Fix issue scrolled to the bottom on navigation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
rudolfs committed Dec 6, 2024
1 parent 15e2935 commit 6206e55
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/views/repo/Issue.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -77,6 +78,7 @@
topLevelReplyOpen = false;
editingTitle = false;
updatedTitle = issue.title;
focusReply = false;
});
const project = $derived(repo.payloads["xyz.radicle.project"]!);
Expand Down Expand Up @@ -132,6 +134,7 @@
behavior: "smooth",
block: "center",
});
focusReply = true;
}
async function reload() {
Expand Down Expand Up @@ -541,7 +544,7 @@
<CommentToggleInput
disallowEmptyBody
rid={repo.rid}
focus
focus={focusReply}
onexpand={toggleReply}
onclose={topLevelReplyOpen
? () => (topLevelReplyOpen = false)
Expand Down

0 comments on commit 6206e55

Please sign in to comment.