Repository navigation
fix(raw): scroll every pane together in the raw view (#9) - #11
Merged
Merged
Conversation
Closes #9. Side-by-side raw panes scrolled independently, so a glance across the gutter landed on a different region in each file and the reader had to steer both scrollers by hand. Panes now mirror each other proportionally: scrollTop / (scrollHeight - clientHeight), applied to every other pane. The files are rarely the same length, which is usually why they are being compared, so equal fractions keep the eye in the same relative place where equal line numbers would run off the shorter file. Three details that decide whether it is usable: - an echo guard: writing scrollTop fires a scroll event on the pane we just moved, and treating that as input makes the panes chase each other. Each pane records what was last written to it and ignores a matching event. - panes that fit are skipped, so a six-line file cannot drag the others to the top as the pointer crosses it. - a visible toggle (aria-pressed, on by default), which PRD US-14 already asked for and which keeps a stuck pane from looking like a bug. Each pane is also focusable and focus-visible ringed, because a scroll region that cannot be focused cannot be scrolled without a mouse, and each section is named by its file. Covered by tests/component/raw-view.test.tsx (7, with geometry stubbed since jsdom has no layout) and an e2e case that measures real layout in the CI browser matrix. Suite is 402 tests; the generated badge moved with 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.
Closes #9.
Side-by-side raw panes scrolled independently, so a glance across the gutter landed on a different region in each file — the reader had to steer both scrollers by hand, which is exactly the work the raw view exists to remove.
What changed
Panes now mirror each other proportionally:
Proportional rather than line-for-line, because the files are rarely the same length — that is usually why they are being compared. Equal fractions keep the eye in the same relative place; aligning line 40 of a 60-line file with line 40 of a 400-line file just runs off the end of the shorter one.
Three details that decide whether it is usable:
scrollTopfires a scroll event on the pane we just moved; treating that as reader input makes the panes chase each other frame after frame. Each pane records the value last written to it and ignores a matching event.aria-pressed, on by default, hidden with a single file) — the PRD's US-14 already specified a toggleable sync scroll, and it keeps a stuck pane from looking like a bug.While in the file: each pane is now
tabIndex={0}and focus-visible ringed (a scroll region that cannot be focused cannot be scrolled without a mouse), and each<section>carries the file name as its accessible name.Verification
tests/component/raw-view.test.tsx— 7 tests: proportional mirroring across panes of different lengths, every pane following (not just the second), the echo guard, sync off, a source pane with no overflow, keyboard reachability, pane labels. jsdom has no layout, so geometry is stubbed — the sync is arithmetic on those numbers.e2e/tool.spec.ts— a case that measures real layout in the CI browser matrix (120-line vs 60-line files, half-scroll, then toggle off and confirm the pane stays put).npm run check— 402 tests / 22 files, tsc clean, build ✓, privacy guard ✓.