Repository navigation
feat(web): keyboard review flow — advance after marking, r/o shortcuts, vim scrolling - #40
Merged
Merged
Conversation
Marking a file reviewed via the keyboard now scrolls to the next file instead of restoring a stale scroll offset (which could land at the top or on an unrelated file when hide-reviewed remounts the view). Also widen the current-file header tolerance so a pinned header isn't mistaken for the previous file, which made m mark the wrong file.
r matches the Reviewed button label; m still works but is no longer listed.
Lets a reviewed (auto-collapsed) file be reopened from the keyboard without un-marking it. Collapsing a reviewed file no longer records a manual collapse, so un-marking it later expands it again.
j/k scroll about three lines, d/u half a page (Vimium-style, since Ctrl-d/u belong to the browser), gg/G jump to the top/bottom. Single presses scroll smoothly; key repeat scrolls instantly so holding a key doesn't lag.
- Fold the vim scroll keys into the keydown switch; read clientHeight only for d/u. - Scroll via CodeView's containerRef instead of the area's firstElementChild. - Return a stable EMPTY_SET when nothing is hidden so marking reviewed no longer re-runs the scroll-restore effect; call scrollToFile from it via useEffectEvent. - toggleReviewed returns the new state; toggleFileCollapsed uses reviewedNames. - Share one afterLayout() double-rAF helper; drop comments that restate the code.
The restore ran two frames after mount, before CodeView had laid out its content, so scrollTop clamped to 0. Retry each frame until the content is tall enough (or a 3s deadline passes), and stop if the user scrolls first.
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
scrollTop(landing at the top or on an unrelated file); with it off, the file just collapsed in place. Now it scrolls to the next file's header likendoes. The hide-reviewed path scrolls after the remount via a pending target instead of the saved offset; the collapse path waits two frames so the target offset isn't computed from pre-collapse heights.n, the previous file's sticky header is still in the DOM at about −6px while the current header sits 9px below the scroll area's top, andgetCurrentFileonly allowed 8px, so it picked the previous file. Tolerance is now 24px (CURRENT_FILE_HEADER_SLOP_PX).rmarks a file reviewed (matches the "Reviewed" label).mstill works as an undocumented alias.oexpands or collapses the current file, so a reviewed (auto-collapsed) file can be opened without un-marking it. Collapsing a reviewed file no longer records a manual collapse, so un-marking it later expands it again.j/k(60px),d/u(half page, Vimium-style since Ctrl-d/u belong to the browser),gg/G(top/bottom). Single presses scroll smoothly; key repeat scrolls instantly.scrollTopclamped to 0. It now retries each frame until the content is tall enough (3s deadline) and stops if the user scrolls first.containerRef, a stable empty set so marking reviewed doesn't re-run the scroll-restore effect,toggleReviewedreturns the new state, oneafterLayout()helper, and comments that restated the code removed.Testing
oxlintandoxfmt --checkpass;vite buildsucceeds.n n+ scroll +rmarks the file in view (it used to mark the previous one); repeatedrwalks c → d → e → f.pback to a reviewed file,oexpands it while it stays reviewed,ocollapses it,run-marks it and it expands.j/k/d/umove by the expected amounts;Greaches the exact bottom (166,605px on the large diff), a singlegdoes nothing, andggreturns to the top.