fix(diffs): auto-scroll when dragging past viewport#360
Open
wsoule wants to merge 1 commit intopierrecomputer:mainfrom
Open
fix(diffs): auto-scroll when dragging past viewport#360wsoule wants to merge 1 commit intopierrecomputer:mainfrom
wsoule wants to merge 1 commit intopierrecomputer:mainfrom
Conversation
|
@wsoule is attempting to deploy a commit to the Pierre Computer Company Team on Vercel. A member of the Team first needs to authorize it. |
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.
Description
Before:
https://github.com/user-attachments/assets/b8681a0f-ab62-4df6-9b5d-bff0bad6f982
After:
Screen.Recording.2026-02-26.at.09.20.59.mov
Before:
When clicking a line number and dragging past the top or bottom of the viewport:
No auto-scroll: the page doesn't scroll, so lines outside the current viewport are unreachable during a drag.
After:
requestAnimationFrameloop kicks in when the pointer is within 80px of the viewport top or bottom. Each frame it callswindow.scrollBy, then re-queries the element at the same screen coordinates (which have shifted after scrolling) to extend the selection to newly visible lines. The loop stops on pointer up or when the cursor moves back into the safe zone.The scroll speed ramps linearly from 0 at the zone boundary up to 20px/frame at the screen edge.
Note: the 80px and 20px/frame may need to change.
Motivation & Context
When selecting lines that goes past the view window, you must cancel your selection, scroll down, and redo the selection. If said selection is larger than the view window, you must make your screen larger to select all content.
This change make it so the page auto scrolls with the selected lines.
Type of changes
first discussed with the dev team and they should be aware that this PR is
being opened
You must have first discussed with the dev team and they should be aware
that this PR is being opened
Checklist
contributing guidelines
bun run lint)bun run format)bun run diffs:test)How was AI used in generating this PR
Used to assess whether to use requestAnimationFrame or setInterval on scrolling.
Related issues