@@ -127,6 +127,8 @@ export function ReviewShell({
127127 const reviewHost = useService < ReviewHost > ( REVIEW_HOST ) ;
128128 const taskId = task . id ;
129129 const listRef = useRef < VListHandle | null > ( null ) ;
130+ const lastActiveRef = useRef < string | null > ( null ) ;
131+ const navigationLockUntilRef = useRef ( 0 ) ;
130132
131133 const workerFactory = useCallback (
132134 ( ) => reviewHost . diffWorkerFactory ( ) ,
@@ -215,9 +217,11 @@ export function ReviewShell({
215217 const viewed =
216218 currentSignature !== undefined &&
217219 isFileViewed ( viewedRecord [ scrollRequest ] , currentSignature ) ;
220+ navigationLockUntilRef . current = Date . now ( ) + 500 ;
218221 if ( ! viewed ) onUncollapseFile ?.( scrollRequest ) ;
219222 requestAnimationFrame ( ( ) => {
220223 listRef . current ?. scrollToIndex ( targetIndex , { align : "start" } ) ;
224+ lastActiveRef . current = scrollRequest ;
221225 setActiveFilePath ( taskId , scrollRequest ) ;
222226 clearScrollRequest ( taskId ) ;
223227 } ) ;
@@ -232,9 +236,10 @@ export function ReviewShell({
232236 viewedRecord ,
233237 ] ) ;
234238
235- const lastActiveRef = useRef < string | null > ( null ) ;
236239 const handleScroll = useCallback (
237240 ( offset : number ) => {
241+ if ( Date . now ( ) < navigationLockUntilRef . current ) return ;
242+ navigationLockUntilRef . current = 0 ;
238243 const handle = listRef . current ;
239244 if ( ! handle ) return ;
240245 const index = handle . findItemIndex ( offset ) ;
@@ -247,6 +252,10 @@ export function ReviewShell({
247252 [ items , setActiveFilePath , taskId ] ,
248253 ) ;
249254
255+ const handleUserScrollIntent = useCallback ( ( ) => {
256+ navigationLockUntilRef . current = 0 ;
257+ } , [ ] ) ;
258+
250259 const renderItem = useCallback (
251260 ( item : ReviewListItem ) => (
252261 < div
@@ -333,6 +342,8 @@ export function ReviewShell({
333342 shift = { false }
334343 style = { { scrollbarGutter : "stable" } }
335344 onScroll = { handleScroll }
345+ onWheel = { handleUserScrollIntent }
346+ onKeyDown = { handleUserScrollIntent }
336347 data = { items }
337348 >
338349 { renderItem }
0 commit comments