feat: bidirectional scroll navigation between annotations and highlights#253
Merged
backnotprop merged 2 commits intobacknotprop:mainfrom Mar 9, 2026
Conversation
When reviewing long plans with many annotations, it's hard to visually connect which annotation card corresponds to which highlighted line. - Click annotation card → scrolls content to the highlight + applies a bright cyan "focused" color for visibility - Click highlighted text → scrolls the right panel to bring the corresponding annotation card into view - Works with both web-highlighter and manually created (shared/imported) annotations - Handles edge cases: global comments (no highlight), multi-node selections, already-visible elements Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Change scrollIntoView block from 'nearest' to 'center' so targets appear prominently in the middle of the viewport - Track just-created annotation IDs to skip scroll+focus effect when a new annotation is added (user is already looking at it) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7f88f1d to
6e1b685
Compare
Owner
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Owner
|
This is live in v0.11.4. Thanks @grubmanItay! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.annotation-highlight.focusedCSS class with dark and light mode supportMotivation
When reviewing a long, detailed plan with many annotations — especially after importing a teammate's review — it's easy to lose track of which annotation card corresponds to which highlighted line in the content. The existing behavior only applies a subtle selected border to the card when a highlight is clicked, but doesn't scroll either panel, forcing the user to manually hunt for the matching element.
How it works
Viewer.tsxwatchesselectedAnnotationIdand useshighlighter.getDoms()(for web-highlighter annotations) orquerySelector('[data-bind-id]')(for shared/imported annotations) to find thecorresponding
<mark>elements. It applies a.focusedclass (bright cyan glow) and callsscrollIntoView({ behavior: 'smooth', block: 'center' }).AnnotationPanel.tsxwatchesselectedIdand scrolls the matching[data-annotation-id]card into view within the panel's scroll container usingblock: 'center'.justCreatedIdReftracks newly created annotation IDs so the scroll+focus effect is skipped when the user just added an annotation (they're already looking at it).Test plan
🤖 Generated with Claude Code