feat(mark-viewed): pin the next file under the sticky header - #2
Merged
Conversation
GitLab's "show one file at a time" mode swaps the diff in place and leaves the viewport where it was. A long commit message then sits between the top of the page and the file, so every "v" needs a manual scroll before the diff is readable. After triggering GitLab's own "next file" shortcut, re-pin the newly focused file under whatever is sticky at the top edge. The pin runs for 400ms, because the swap takes a few frames and the file grows as its lines render. It waits for the file hash to change, so the last file scrolls nothing. Claude-Session: https://claude.ai/code/session_01EkNmqezTVuLFRsSebUFKFq
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.
Problem
In GitLab's "show one file at a time" mode the diff swaps in place and the viewport stays where it was. A long commit message then sits between the top of the page and the file. Every
vneeds a manual scroll before the diff is readable.Change
gitlab-mark-viewed.user.js0.4.0 → 0.5.0.After triggering GitLab's own "next file" shortcut, the script re-pins the newly focused file under whatever is sticky at the top edge.
fileKey(file)reads the diff container'sid(the file hash), falling back todata-path.pinNextFile(previousKey)runs arequestAnimationFrameloop for 400ms. The swap takes a few frames and the file grows as its lines render, so one scroll is not enough.In multi-file mode GitLab's
jalready lands correctly and the pin agrees with it.Verification
bun run lintandbun run formatpass.format:fixalso reflowed the README table, so that diff is wider than the one row edited.Not tested against a live merge request.
https://claude.ai/code/session_01EkNmqezTVuLFRsSebUFKFq