@@ -43,22 +43,21 @@ export const Overview = (pr: PullRequest) => {
4343 }
4444
4545 // Use IntersectionObserver to detect when the title becomes sticky
46- // The sentinel is positioned right above the title
47- // When sentinel scrolls out of view (top of viewport ), title becomes stuck
46+ // The sentinel is positioned right before the title
47+ // When sentinel is fully scrolled out of view (past the top ), title becomes stuck
4848 const observer = new IntersectionObserver (
4949 ( [ entry ] ) => {
50- // When sentinel is visible, title hasn't become stuck yet
51- // When sentinel is not visible (scrolled past top), title is stuck
50+ // When sentinel is intersecting ( visible) , title is NOT stuck
51+ // When sentinel is not intersecting (scrolled past top), title IS stuck
5252 if ( entry . isIntersecting ) {
5353 title . classList . remove ( 'stuck' ) ;
5454 } else {
5555 title . classList . add ( 'stuck' ) ;
5656 }
5757 } ,
5858 {
59- // Use rootMargin to trigger slightly before reaching the top
60- rootMargin : '-1px 0px 0px 0px' ,
61- threshold : [ 1 ]
59+ // No rootMargin - just detect when sentinel leaves viewport naturally
60+ threshold : [ 0 ]
6261 }
6362 ) ;
6463
@@ -70,7 +69,7 @@ export const Overview = (pr: PullRequest) => {
7069 } , [ ] ) ;
7170
7271 return < >
73- { /* Sentinel element positioned just before the sticky title - must have height to be observable */ }
72+ { /* Sentinel element positioned just before the sticky title */ }
7473 < div ref = { sentinelRef } style = { { height : '1px' } } />
7574 < div id = "title" className = "title" ref = { titleRef } >
7675 < div className = "details" >
0 commit comments