Repository navigation
fix(editor): scroll combined diffs with keyboard navigation - #35004
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 3

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b4a91cda-6ee5-49f4-ac2b-d157ded80663
Files selected for processing: 8-
src/renderer/src/components/editor/DiffSectionBody.tsxsrc/renderer/src/components/editor/DiffSectionHeader.tsxsrc/renderer/src/components/editor/DiffSectionItem.tsxsrc/renderer/src/components/editor/combined-diff-cursor-reveal.test.tsxsrc/renderer/src/components/editor/combined-diff-cursor-reveal.tssrc/renderer/src/components/editor/combined-diff/scroll-viewport/combined-diff-render-range.tssrc/renderer/src/components/editor/combined-diff/scroll-viewport/use-combined-diff-virtualizer.tssrc/renderer/src/components/editor/diff-section-height-measurement.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
-
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
723813be-eca0-482b-b57b-1ee4157bb9c9
Files selected for processing: 2-
src/renderer/src/components/editor/combined-diff-cursor-reveal.test.tsxsrc/renderer/src/components/editor/combined-diff/scroll-viewport/combined-diff-render-range.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
There was a problem hiding this comment.
Actionable comments posted: 1

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
2d293a91-d40a-498a-b88a-fb491dd0e74f
Files selected for processing: 14-
src/renderer/src/components/editor/DiffSectionBody.word-wrap-lifecycle.test.tsxsrc/renderer/src/components/editor/DiffSectionHeader.tsxsrc/renderer/src/components/editor/combined-diff-cursor-reveal.test.tsxsrc/renderer/src/components/editor/combined-diff-cursor-reveal.tssrc/renderer/src/components/editor/combined-diff-review-host.fixture.tssrc/renderer/src/components/editor/combined-diff-viewport.tssrc/renderer/src/components/editor/combined-diff/CombinedDiffViewer.tsxsrc/renderer/src/components/editor/combined-diff/scroll-viewport/combined-diff-render-range.test.tssrc/renderer/src/components/editor/combined-diff/scroll-viewport/combined-diff-render-range.tssrc/renderer/src/components/editor/combined-diff/scroll-viewport/combined-diff-section-list.tsxsrc/renderer/src/components/editor/combined-diff/scroll-viewport/use-combined-diff-direct-scroll-input.tssrc/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-body.tsxsrc/renderer/src/components/github-item-dialog/inspect-pull-request/pr-files-combined-diff-viewer.tsxsrc/renderer/src/components/pull-request-page/files/combined-diff-viewer.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
-
There was a problem hiding this comment.
Duplicate comments: 1
src/renderer/src/components/editor/combined-diff-cursor-reveal.test.tsx: 1
2-2:Major · Functional Correctness · Quick win Remove the unused
Reactdefault import.The current typecheck still fails with TS6133 at Line 2. The file uses the automatic JSX runtime. The file does not reference
Reactas a value.🐛 Proposed fix
-import React, { useLayoutEffect, useRef, useState } from 'react' +import { useLayoutEffect, useRef, useState } from 'react'Source: Pipeline failures

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
03952d40-d8b3-4adb-bf66-e9e87a130150
Files selected for processing: 4-
src/renderer/src/components/editor/combined-diff-cursor-reveal.test.tsxsrc/renderer/src/components/editor/combined-diff-operation-counts.test-fixture.tssrc/renderer/src/components/editor/combined-diff-review-host.test-fixture.tssrc/renderer/src/components/editor/combined-diff-worktree-tree.fixture.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
-
|
Arrow-key navigation in combined diffs could move the cursor off screen because a surrounding view owns scrolling. This PR maps keyboard cursor geometry into that view below the sticky file header in worktree Changes and both PR Files hosts. Mouse/API cursor changes preserve the current outer scroll. Reduced head Validation:
For Brennan’s review:
Timing limits: matched endpoint observation was delayed after a sampler error, with no replay. Probe early sample used a bounded fallback (~748ms, zero RAF callbacks), followed by ~2s/~5s samples. The early probe sample had a CSS-hidden caret, so continuous painted visibility is not claimed. No two-RAF, frame-time or universal timing guarantee. Inline and the two PR hosts are covered by current real-Monaco tests; old pre-simplification captures are historical for the changed flow. Existing limitation: the earlier F7/deleted-line/Enter/44Down inline-original route followed vertically but its five-pixel pane clipped the caret horizontally. Independent pinned-main source comparison established the same layout/focus path; no rendered main comparison of that separate limitation was run. It remains tracked in STA-12731, not a passing visible-original route. Intended difference from the common pattern: retain full-height sections and explicitly map the rendered keyboard cursor to native outer scroll. Existing height measurement, virtualization and anchor behavior remain. Source spots: cursor mapping, mount/disposal. |
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryCombined diffs now scroll the surrounding view to keep keyboard cursor movement visible.
No actionable issues were found. Acknowledgment: brennanb2025 explicitly identified the existing horizontally clipped original caret in inline mode as outside this vertical-scroll change and deferred it to STA-12731.
|
Keep keyboard cursor geometry mapped to the surrounding viewport and sticky header. Remove speculative focused-row retention, deferred following and its manual-input cancellation; restore existing section-height measurement. Retain split/inline real-Monaco keyboard cases, click-source preservation, and both PR Files hosts covering the review-found missing viewport markers. Drop redundant timing, tree and operation-count fixtures and restore render-range baseline tests.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Upstream changed providers' getDiff arity (stablyai#34779), UpdaterState (stablyai#34104), DiffSectionBody props (stablyai#36577, stablyai#35004), combined diff list props (stablyai#36921), the native chat setting (stablyai#36110), recovery launches waiting for the prompt (stablyai#36210), conflict-resolution props (stablyai#35347) and row-opening params (stablyai#36301). The saved-event case for a write whose views all closed is dropped: upstream no longer notifies then (stablyai#31617), as decided for this rebase.
Before / After
In worktree Changes → View all, choose split mode, click modified line 1 in the 220-line
cursor-scroll.tsfile, then press Down 80 times.Before — main: The cursor reaches line 81 off screen, while the view stays on lines 1–57.
After — this PR: The view scrolls to line 81 and keeps its cursor visible below the sticky file header.
Both runs used the same repository, unchanged file, 1920×1152 client, pane sizes and font, starting at line 1, column 1 with scroll offset 0. Neither run used manual scrolling after the key sequence.
c3518250400ba825Capture note: a fixed developer toolbar was disabled for After so it could not cover the caret. Window, pane, font and viewport measurements stayed identical; no product or DOM styling was changed.
Problem and change
Keyboard navigation in combined diffs could move the cursor off screen because each embedded editor fills its section and does not know the surrounding view's visible area.
The surrounding view now scrolls vertically on keyboard cursor movement, keeping the cursor below the sticky file header in split mode and the visible modified editor in inline mode. This applies to worktree changes, the PR Files page, and the inspect-PR Files dialog. Mouse and API cursor changes preserve the current outer scroll position.
The implementation uses Monaco's current rendered cursor geometry and the nearest marked outer scroll container. It adds no persistent following state, layout listeners or focused-row retention, and keeps the existing height measurement and virtualization behavior. This is an intended difference from the common pattern: the existing full-height sections need an explicit mapping to the outer viewport.
Validation
400ba8256b0d8cfcc7e05f0f3ad5accc23837528. CI: green on the same head: static analysis/typecheck, 12 test shards, both package jobs and the PR gate (run 40988029922).400ba825reproduces the identical 80-Down case: line 81, scroll 0→433, full 18px cursor at y1110–1128; the whole-window PNG was inspected. One wrapped, nonfinal hidden-tail probe recorded real section growth 614→632px while cursor geometry remained within the viewport and the same editor remained mounted through ~5 seconds. The early fallback sample had a CSS-hidden caret; at ~5 seconds the full caret was visible and unobscured. No late-settle failure was reproduced, so deferred following and manual-yield support remain removed (probe capture). The matching main Before remains valid; only After was rerun after the production reduction. No general late-layout guarantee is claimed.ce3c8d1383c42e7c8f055a9f7e8412d516b39737confirms the same layout/focus path and locked Monaco version. No rendered main comparison of this separate limitation was run. The inherited exposure bug is tracked in STA-12731.Tracked in STA-10358 and tracked in #28074.
Earlier visual evidence
Historical captures before simplification
These captures predate the reduced implementation. They are retained as history; the refreshed After above and current tests validate the reduced head.
Split: keyboard cursor at the lower visible edge.
Inline: keyboard movement keeps the modified cursor visible.
Real PR Files: keyboard reveal below the sticky file header.
Existing inline accessibility limitation: vertical reveal occurs, but the hidden original caret is horizontally clipped. This is a failing visibility observation, not a passing screenshot.