Skip to content

Restore keyboard reach to scrolling diff code - #2287

Merged
leaf-agent merged 3 commits into
mainfrom
fix/ci-38051185604-diff-reach
Oct 11, 2026
Merged

leaf-agent merged 3 commits into
mainfrom
fix/ci-38051185604-diff-reach

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

The shared stylesheet refactor in PR #2252 exposed a diff code region that overflows horizontally. Its generated line-comment buttons have tabindex="-1", but reachScrollers treated any descendant button as a Tab route and withheld the region's own stop. Keyboard readers could not reach the clipped lines, both on the page and in a panel reply.

Use the existing tabStops reading from the focus owner to decide whether a scroll box already contains a reachable control. This counts enabled, visible controls actually in the Tab order and lends the diff code region a stop when its buttons are programmatic only. Both failing browser journeys pass locally, as do 308 runtime tests. A served 420px comparison loaded the same 254 requests through authoritative presentation in base and candidate; the candidate delivered 247 more bytes on that path for the reachability fix, with the same three diagnostic startup shifts.

The failures appeared in the main CI run.

A diff line can contain generated comment buttons with tabindex -1. Those buttons do not give the keyboard a route into its horizontally scrolling code. Reuse the canonical tabStops reading when deciding whether to lend the scroll box its own stop; the two browser journeys for page and panel diffs now pass.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

holdsOwnStop now trusts tabStops(el), but that helper calls checkVisibility() without checking CSS visibility. A descendant button under visibility: hidden therefore counts as a Tab route even though Chrome skips it, leaving an overflowing authored region without a keyboard stop. The focused browser test test_a_hidden_control_does_not_take_a_scroll_boxes_keyboard_route reproduces this on the reviewed head. The shared focus reading needs to exclude controls hidden by visibility before reach uses it.

Treat CSS visibility as part of the shared tab-stop reading. Without it, a hidden button was counted as the scroller's keyboard route and kept an overflowing region out of Tab order. The browser test reproduces the missing route and verifies the lent stop receives keyboard focus.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current test job fails at test_a_hidden_frame_judges_existing_records_without_awaiting_paint[resize-during-drain], so this head is not ready to merge. PR #2307 addresses that shift-watch failure.

max-sixty added a commit that referenced this pull request Oct 11, 2026
lf-diff had two render pipelines: `render` for a patch text (inline or
bound) and `renderManifest` for a file manifest. Each built its own
entries, controls, staging and projection, so every fix had to land
twice (#2125 brought the text path level with the manifest path). Now
every source form becomes one list of per-file records shaped like the
contract's manifest, and one plan/prepare/apply path renders them all.

- **One pipeline.** `sourceRecords` parses a patch text once and gives
each record its parsed file; a manifest is already that list.
`prepareEntry` reads an in-memory record's file and fetches a manifest
record's patch with `loadDeferred`. A single `fileEntry(row)` replaces
the three entry literals. One `projectFiles` takes its origin from the
source form: `files[i].path`/`files[i].patch` for a manifest, the whole
delivery for a bound patch text, and none for an inline patch. The
record now paints each file's summary, so `renderFile` returns only the
evidence that goes under it.
- **Behavior change: collapsed files render lazily in every form.** A
closed file in an inline or bound patch text now renders when it opens,
as a manifest's file already did. Until then, `lfDataDatum` resolves its
lines to the file row, and a reveal or hunk walk opens and loads the
file. A render failure inside one file shows that file's error box, as a
manifest file's load failure already did, instead of failing the whole
widget.
- **The contract states the manifest's rules.** `records.key` is now
`path`, and the redundant `key` field is gone from the schema and from
`patch_manifest.py`. `files` requires at least one record, and a rename
record requires `previousPath`. `data set` therefore refuses `{"files":
[]}`, duplicate paths and a rename with no source path, and the widget's
own shape checks are deleted. A patch text that repeats a path is
refused the same way, with "unified diff repeats file path".
- **Failure box.** `failSoft` receives the source only when it is patch
text, so a manifest failure no longer prints `[object Object]`.
- **Inline lazy loads survive a reconnection.** An inline diff keeps its
entries when it reconnects. A load abandoned by a disconnect is tied to
its render, so opening the file again starts a fresh load.

The JavaScript patch validator stays in the widget; #1082 deliberately
took patch parsing out of core. This change touches none of the runtime
files that #2287 edits, and
`test_a_scroll_box_inside_a_widgets_shadow_tree_takes_the_keyboard`
fails on main until #2287 lands.

Tests: the lf-diff selections in the widgets, anchors, projection and
threads render files pass (88), and so do the other 155 tests that
mention lf-diff or the manifest, apart from the reach test above. The
test changes: manifest fixtures drop `key`, a new test covers the three
contract refusals, a repeated-path refusal joins the rejection cases,
and the collapsed-diff test asserts that lines render only on open.

> _This was written by Claude Code on behalf of max-sixty_

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@leaf-agent
leaf-agent merged commit 58b2776 into main Oct 11, 2026
6 of 8 checks passed
@leaf-agent
leaf-agent deleted the fix/ci-38051185604-diff-reach branch October 11, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant