Repository navigation
Review: the file list stays put when you open a file - #2817
Merged
Merged
Conversation
Pierre counted an 8px gap around every hunk separator that our theme CSS never draws (the separator's own 4px margins replace it), so an open file was laid out 48px taller than drawn. Pierre's sticky window then sat at the bottom of that room: in a list that just outgrows the view, every header moved 9-25px down under the pointer and the next click opened another file (#2713). Count no gap in every mode, as the page-scrolling view already did.
…e list Opening a file auto-marks the one you left as viewed. With Hide viewed on, that row went at once and the rows under it moved 28px under the pointer. While the pointer is in the panel, hide only what was viewed when it came in; the rest goes when it leaves (#2713).
With the mouse resting over the panel, files viewed by j/k, the arrows, Home/End or Cmd+P kept their rows until the mouse left, so a keyboard user saw Hide viewed do nothing. A key press in the panel now releases the hold; the pointer's next move takes it again. With Hide viewed off the hook keeps no hold, so crossing the panel edge no longer redraws the list. DOM tests for the hook: enter/leave, the keyboard release, the toggle, the off case.
On a live checkout the header's last button is "Choose app to open in", not "File actions", so the spec found no headers and timed out waiting for 15. Key each header by its path span (title), which every mode draws, and click the path itself.
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 #2713. Thank you @barreiroleo for the report, and for the two screenshots with the pointer in the same place. They showed exactly where to look.
What was wrong
I reproduced both causes in headless Chromium against the built review page, before and after the change, at the issue's window size of 1274×1185. A small one-off server sent the page the real
git diffof a scratch repo shaped like the one in the issue: 15 changed files in nested folders. My sandbox could not start theplannotatorbinary itself, but the bug is all in page layout. The new e2e spec runs the real binary in CI.1. The All changes list (the one in the issue's screenshots). With every file folded, opening one pushed every header down. Over 11 runs the rows above the opened file moved 8–25 px (the amount includes a random jitter from Pierre). In one 19 px run, the pointer that had been on
service.hppended up onoperation.hpp, so the next click opened the wrong file. A gap opened above the first header, as in the second screenshot.The cause: Pierre's layout estimate counts an 8 px gap around each hunk separator, but our theme CSS never draws that gap (the separator's own 4 px margins replace it). So an open file was laid out taller than it is drawn: 637 px estimated against 589 px drawn for a file with three hunks. Pierre keeps its rendered window in a
position: stickybox. When the list is shorter than the view, that box sits at the bottom of the extra room, which pushes the whole list down. The page-scrolling view (Guided Reviews in the Inbox) already counted no gap. The normal review view did not.2. The file tree with Hide viewed on. Opening a file auto-marks the one you left as viewed. With Hide viewed on, that row disappeared at once and the rows under it moved up 28 px. Clicking
operation.hppand thenservice.hppleft the pointer on thesrc/transportfolder row. Scrolled to the bottom, the next click hitCMakeLists.txtinstead ofoperation.hpp.With Hide viewed off, the file tree never moved: 0 px in every case I tried (top and bottom of the list, a folder with one file, a tall and a short window). The sticky tools block stayed 64 px tall and the "N of 15 viewed" line stayed 18 px tall. The list did not re-sort, and its width did not change, so no scrollbar appeared or disappeared.
The fix
AllFilesCodeView.tsx: count no gap around separators in every mode (spacing: 0, keeping the 8 px under the last row), as the page-scrolling view already did. Pierre's estimate now matches what is drawn.useHiddenViewedFiles(new, used byFileTreeandSectionsPanel): while the pointer is in the panel, Hide viewed hides only what was already viewed when the pointer came in. A file that becomes viewed meanwhile keeps its row until the pointer leaves the panel. Turning Hide viewed on still hides everything viewed at once.Before and after
The same script, the same clicks:
The before and after stills, with the pointer drawn in, are with the owner.
Tests
useHiddenViewedFiles.test.ts: what Hide viewed hides while the pointer is in the list and after it leaves.tests/e2e/review-file-list-stays-put.spec.ts: both cases in a real browser against the compiled binary. I left it to CI. I ran the same checks as a one-off script against the old and new builds: both fail on the old build and pass on the new one.FileTree.*,FileTreeNode.controls,PanelChrome, and theAllFilesCodeView.*files.