Repository navigation
Finish comment panel keyboard navigation - #76
Conversation
leaf-agent
left a comment
There was a problem hiding this comment.
One finding, on Shift+Escape rather than on the address chord.
The row promises a page the reader can't scroll once the panel covers it. COVERING is (width <= 840px), and under it chrome-style.js sets body[data-lf-panel] { overflow-y: hidden; } — so while the panel is open on a narrow window the page scroller is locked. letGo hands focus to document.body anyway, which is exactly the state its own comment says focusing body exists to avoid ("Space goes on doing nothing until the next click in the page"). The Escape ladder never produces it: rung() returns the close comments branch while panelOpen, so letGo is only ever reached with the panel shut. This row is the first press that reaches it with the panel standing.
Measured on this branch, same page and gesture at two widths:
| window | after Shift+Escape |
Space | ↓ | d |
|---|---|---|---|---|
| 1400px (beside) | on body, overflow-y: auto |
page +735 | page +775 | page +1198 |
| 800px (covering) | on body, overflow-y: hidden |
0 | 0 | page 0, list +322 |
So on the narrow window the reader is told page — comments kept, lands on the page, and every scroll key is either dead or still moving the panel's list — stepScroller reads panelCovers(), so d/u stay with threadsBox regardless of where focus went. Suggested guard inline: !panelCovers() is the same shape w and / already use to keep this scope from advertising a press that can't act, and over the page the ladder's close comments rung is already the honest answer.
Two smaller notes:
Shift+Escis Chrome's own Task Manager accelerator on Windows/Linux. I have not confirmed whether a page'spreventDefaultwins there, and the suite can't tell you — Playwright dispatches through CDP, which bypasses browser accelerators — so it's worth one press in a real Chrome before the key line starts naming it.- The reflow at
address.jsleft a mid-sentence break: line 39 is now just// digit consumes the mode; sowith// does Escape…on the next. The paragraph wants one rewrap (it runs past the hunk, so no suggestion).
The chord half reads well — t/b shadow no ADDRESSES letter, !aimedList keeps them out of the digit stage, setChord(false) lands before the scroll like the edge row's, and the fixed panel keeps scrollIntoView off the document scroller. Both new tests assert the placement against the list's own scroll-padding rather than a constant, which is the right authority.
How the measurement was taken
An ad-hoc test against PANEL_PAGE with 16 comments, reduced_motion="reduce", focus placed on a thread card with preventScroll, then Shift+Escape followed by Space, ArrowDown, d, reading document.body.scrollTop and .lf-threads scrollTop after each. Run at viewport width 800 and 1400 on 0abe645; no console errors either way. The file was removed afterwards — nothing is committed.
leaf-agent
left a comment
There was a problem hiding this comment.
The gate is right. Measured on 498ff27 at the two widths, Shift+Escape leaves document.activeElement on the .lf-thread under COVERING and moves it to document.body beside the page — which is what the row now promises. My finding is on the test that ships with it: it passes with the fix reverted.
Removing when: () => !panelCovers() from the row and running test_shift_escape_is_not_offered_while_the_panel_covers_the_page gives 1 passed. Two reasons, both structural rather than a near miss:
- The key line never carries this chip in this arrangement. With a thread focused, the visible
.lf-keychips are⏎ replyandesc close comments— at 800px and at 1400px. The row sits last inPANEL.rowsby design ("After the list's own rows so this occasional crossing does not displacewand/"), so it is below the line's room cut whether it is live or not, andto_have_count(0)cannot fail. - The frame is not settled. The assertion runs on the frame right after
thread.focus(), before the line has repainted — read there, the line is still painting the page's own rows — and a web-first assertion is satisfied on its first poll.
That is the pair tests/CLAUDE.md names under An absence needs a control and a settled frame: "An absence is also what a page that never had the behaviour produces, so a test asserting one names a control that must first produce the presence: the same gesture where it is supposed to work."
Two surfaces do discriminate, both measured at 800 vs 1400 on this head:
| surface | 800px (covering) | 1400px (beside) |
|---|---|---|
Shift+Escape |
focus stays on .lf-thread |
focus on document.body |
? reference (.lf-help) |
no "Return to the page, keeping the comment panel open" | carries it |
key line (.lf-keyline .lf-key) |
⏎ reply, esc close comments |
⏎ reply, esc close comments |
The inline suggestion takes the first: the press's own inertness. I ran it both ways locally — it passes on this head and fails with the gate removed. If you want to keep an unadvertised-surface assertion too, the ? reference is the surface that actually projects this row under COVERING, and the beside-the-page test above it is the control that would have to assert the presence.
How the measurement was taken
An ad-hoc test beside the two new ones, against PANEL_PAGE with the panel opened by click, panel_settled, .lf-threads > .lf-thread focused, and a settling wait before each read. Per width it recorded document.activeElement, the non-[hidden] .lf-keyline .lf-key text, and .lf-help's text after ?. Run at 800 and 1400 on 498ff27, once with the row's when in place and once with the two lines deleted; leaf.js and the probe file were both restored afterwards, and git status is clean — nothing is committed.
The bug-back on the suggestion itself: patch applied to tests/test_render_conversations.py → 1 passed; same patch with when: () => !panelCovers() deleted from leaf.js → 1 failed, the failure naming the reply box under the reader.
|
The final spelling for leaving a beside-panel open is now
|
# Conflicts: # plugins/leaf/skills/leaf/assets/leaf.js
|
Both of my findings survive the respell — measured on One thing the respell introduced, though:
So the reader The row's comment reads it as a shared line ("it follows the focused comment's own placements so they keep the short line a reader standing on that card arrived to use"), and on a line of two that holds — but one of those two is Measurement and reproProbe on shown = page.evaluate(
"""() => [...document.querySelectorAll('.lf-keyline .lf-key')]
.filter(k => !k.hasAttribute('hidden')).map(k => k.textContent.trim())"""
)Baseline: the same probe on Discrimination check on the covering test — with Unmodified, |
leaf-agent
left a comment
There was a problem hiding this comment.
The g p respelling holds up where Shift+Escape didn't: t, b and p shadow no ADDRESSES letter (c, a, l, d), !aimedList keeps all three out of the digit stage, and the layout gate now sits on a row whose liveness the line, the reference and live(row) all read from the same predicate. placeThreadEdge going through native scrollIntoView means the landing is the list's own scroll-padding rather than a second reading of it, and the new edge test asserts against that computed value instead of a constant. The covering-panel test discriminates now that it observes the press: with !panelCovers() removed, letGo() fires and expect(thread).to_be_focused() fails.
One leftover, outside the diff. reconcile.js carries the in-code mirror of the same single-writer list this PR updated in plugins/leaf/skills/leaf/CLAUDE.md — the paragraph beginning "Landing belongs to the list, not to whatever moved the focus", whose closing sentence reads Three callers still write this list's scroll, and each says something focus cannot: and then names stepThread, revealThread and landIn. placeThreadEdge is a fourth: it writes that scroller and says the one thing focus cannot, which edge. The CLAUDE.md row was updated to name it; this one wasn't, so the two enumerations now disagree about how many routes there are. Happy to push the rewrite if you want it — say the word and I'll fold placeThreadEdge into the list in the same voice.
The Chrome Shift+Esc question from the earlier round is moot: the accelerator is no longer on the key line.
|
Closed the remaining runtime-comment mirror in 50c212a:
|
Three test comments state mechanisms or counts the code does not have.
None of them changes what a test asserts — each is the causal argument a
reader leans on when deciding whether the test is still evidence, which
`tests/CLAUDE.md` ("Make a green test non-vacuous") makes load-bearing.
**`test_a_copy_carries_a_workers_standing_report`** names `networkidle`
twice as what ordinarily absorbs the first state read. `ad8bf50` took
`networkidle` out of the export path — `export_page` now goes
`wait_until="load"`, with a comment saying the page holds the news
stream open so the network is never idle and never will be. The same
paragraph says replay's remaining chance is "the 2s retry"; the
corrected text names both asks that sit on the far side of the stamp,
since the stand-in refuses request zero alone — the news stream's ask as
it opens, and the 2s tick behind it, which is still an ask while the
first read is unanswered. The test still proves what it says it proves —
`export_page` waits on `lfApplied >= n_replayed`, a product fact — so
only the explanation moved.
**`test_site.py`'s `site` fixture** says the build checks thirteen
examples. `publish_pages` walks `sorted(EXAMPLES.glob("*.html"))`, which
is eleven. The count is dropped rather than corrected: it is not derived
from anything, so the next example added or removed makes it wrong
again.
**`test_render_controls.py`'s reload block** makes the identical claim
about the same corpus — "every one of the thirteen examples fails on it"
— in the comment that justifies waiting on `BOTH_STAMPS` rather than one
stamp. Same treatment: the count goes, the argument stays.
`render_cases_layout.py` and `tests/CLAUDE.md` also say "all ten
examples", and those stay: they record what a planted cut did when it
was run, not what the corpus is now.
No test accompanies this — the change is comment text only, and all
three files collect and pass `ruff check` / `ruff format --check`
unchanged. The three corrections are independent; any hunk can be
dropped without affecting the others.
<details><summary>Where the code says otherwise</summary>
- `plugins/leaf/skills/leaf/scripts/leaf/rendering.py:886` — "See the
gate: a page listening for news is never network-idle."
- `plugins/leaf/skills/leaf/scripts/leaf/rendering.py:902` — the
`lfApplied` wait the test actually rests on.
- `plugins/leaf/skills/leaf/assets/leaf.js` — `listen()`'s `open`
handler: `if (!readAnswered) void ask();`, and the interval
`readAndPresent().finally(...)` installs: `if (readAnswered)
heartbeat(); else void ask();` at `TICK_MS = 2000`.
- `scripts/site.py:216` — `for source in
sorted(EXAMPLES.glob("*.html")):`
- `examples/` holds eleven `*.html` files.
The wider rename `ad8bf50` began — "poll" as the name for the mechanism
— is still standing in around forty comments across `leaf.js`, the
runtime modules, and `plugins/leaf/skills/leaf/CLAUDE.md`, plus most of
the browser test modules. Those read as a stale noun rather than a false
statement (the heartbeat still re-applies every two seconds, so what
they describe still happens), so they are left alone here — including
the "first poll" in the controls comment this PR otherwise touches.
</details>
---------
Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: Maximilian Roos <[email protected]>
|
Confirmed on The one thing still open from my earlier round is the key-line finding, not this: |
Problem
The comment panel could not hand focus back to the document without closing or widening itself, and a reader standing on a long comment had no direct way to place that card at either edge of the list.
Solution
g pas an address-chord completion that focuses the document while preserving the open panel and its current narrowing when the panel sits beside the page. A covering panel keeps ordinary Escape as the honest route back.g t/g bcompletions for placing the focused comment at the top or bottom of the panel list. The placement uses the list’s existingscroll-padding, so sticky headings and focus rings remain clear.wonly owns Waiting-on-you, while Escape must still release a text search after Enter leaves its box.Testing
uv run pytest tests/test_render_conversations.py -q -n0— 39 passed after merging currentmainuv run pytest tests/test_render_navigation.py -q -n0— 39 passed after merging currentmainuv run pytest tests— 635 passed, 1 skipped after merging currentmainship-reviewat 1200×900 and 800×900 — no crowding or console errors;g pis offered only beside the pageuv run pre-commit run --all-filesCloses #53
Thanks @leaf-agent for the report and the follow-up analysis.