Skip to content

Commit 732f83e

Browse files
fix: account for sticky file header in comment navigation scroll (#67)
When navigating between comments with [ ] in multi-file or git mode, the scroll offset only subtracted the main app header height, leaving the top of the comment card hidden behind the sticky file header. Now also measures the target comment's .file-header height and adds it to the scroll offset. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6c66422 commit 732f83e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

assets/js/document-renderer.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3451,7 +3451,10 @@ function navigateToComment(ctx, direction) {
34513451
ctx._navCommentId = target.dataset.commentId
34523452

34533453
const rect = target.getBoundingClientRect()
3454-
window.scrollTo({ top: rect.top + window.scrollY - headerHeight - 16, behavior: 'smooth' })
3454+
const fileSection = target.closest('.file-section')
3455+
const fileHeader = fileSection ? fileSection.querySelector('.file-header') : null
3456+
const fileHeaderHeight = fileHeader ? fileHeader.offsetHeight : 0
3457+
window.scrollTo({ top: rect.top + window.scrollY - headerHeight - fileHeaderHeight - 16, behavior: 'smooth' })
34553458
target.classList.add('comment-nav-highlight')
34563459
setTimeout(() => target.classList.remove('comment-nav-highlight'), 1000)
34573460
}

0 commit comments

Comments
 (0)