Fix sidebar story list scroll-into-view for off-screen selections#34
Merged
brianlovin merged 3 commits intomainfrom Jan 28, 2026
Merged
Fix sidebar story list scroll-into-view for off-screen selections#34brianlovin merged 3 commits intomainfrom
brianlovin merged 3 commits intomainfrom
Conversation
Use actual item positions from layout instead of hardcoded heights. Story items have variable heights due to text wrapping and optional domain lines, so calculating position as index * (itemHeight + gap) was incorrect. Now uses the rendered item's y position and viewport.height for accurate scroll calculations. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Tests verify that: - Scrolls down when navigating to off-screen story - Scrolls up when navigating back to off-screen story - Does not scroll when story is already visible Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add extra renderer.idle() and renderOnce() after navigation loops to ensure scroll positions are fully applied before assertions. This fixes timing issues that caused CI failures with older Bun versions. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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.
Fixes the bug where navigating with j/k to a story that's off-screen doesn't automatically scroll it into view.
Root cause: Story items have variable heights due to text wrapping and optional domain lines. The previous implementation used a hardcoded
itemHeight = 2and calculated positions asindex * (itemHeight + gap), which was inaccurate.Solution: Use the actual rendered item's Y position and viewport height from the layout engine instead of calculating positions manually. This ensures accurate scroll-into-view behavior regardless of item heights.
🤖 Generated with Claude Code