Skip to content

Commit 863c9f4

Browse files
Copilotalexr00
andcommitted
Explicitly remove stuck class on mount and use threshold 1
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent afd4627 commit 863c9f4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

webviews/editorWebview/overview.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ export const Overview = (pr: PullRequest) => {
4242
return;
4343
}
4444

45+
// Initially ensure title is not stuck
46+
title.classList.remove('stuck');
47+
4548
// Use IntersectionObserver to detect when the title becomes sticky
4649
// The sentinel is positioned right before the title
47-
// When sentinel is fully scrolled out of view (past the top), title becomes stuck
50+
// When sentinel scrolls out of view (past the top), title becomes stuck
4851
const observer = new IntersectionObserver(
4952
([entry]) => {
5053
// When sentinel is intersecting (visible), title is NOT stuck
@@ -56,8 +59,9 @@ export const Overview = (pr: PullRequest) => {
5659
}
5760
},
5861
{
59-
// No rootMargin - just detect when sentinel leaves viewport naturally
60-
threshold: [0]
62+
// Use threshold 1 to only trigger when sentinel is fully visible/invisible
63+
// This prevents false positives when sentinel is partially visible
64+
threshold: [1]
6165
}
6266
);
6367

0 commit comments

Comments
 (0)