Repository navigation
Align page conversation controls and focus across thread counts - #995
Conversation
Move navigation and dismissal into the selected thread toolbar beside settlement while preserving the single-thread metadata row. Retain focus when the shared controls move, and keep resolution keyboard routes working from their new position.
leaf-agent
left a comment
There was a problem hiding this comment.
The metadata row lines up visually in both layouts, but only the multi-thread card actually puts Dismiss in it — and that changes where the runtime thinks the reader is standing.
activeInlineThread() in margin-projection.js opens with active.closest(".lf-conversation-thread[data-thread]"). Reparenting the controls into .lf-thread-meta-actions puts Dismiss inside the card, so that resolves to the card when the passage has two threads and stays null when it has one, where Dismiss is still a child of the absolutely-positioned .lf-margin-preview-head. Measured in a browser on this branch, focus on Dismiss, pressing Threads: with two threads the reader lands on that thread's card (.lf-thread-summary focused inside .lf-thread[data-id]); with one, the panel opens and focus stays on the toggle. stepThread reads the same helper for the t/T walk, so it forks on the same count.
So the count, not the reader's position, decides the answer — and the single-thread card is the one out of line. Routing it through marginControls too, with Dismiss in the row rather than positioned over it, collapses the fork and finishes what the title claims. If the fork should stand for now, the card's header comment is the place to say so; as the code reads today nothing states that a second thread on the passage moves where the reader is.
leaf-agent
left a comment
There was a problem hiding this comment.
Dismiss now sits in the card's metadata row at either thread count, so activeInlineThread() no longer forks on the count — the earlier finding is closed. Two things the move leaves behind.
The row's order is declared once, then re-derived control by control. ThreadView.present builds actions as the exact order #metadataActions should hold, and then realizes that order with a positional anchor per control: prepend nav, insertBefore(markRead, settlement), insertBefore(settlement, close), append(close). This commit added two of those four, each of which now has to be kept consistent with actions by hand, so the next control the row gains costs a fifth. CLAUDE.md's Stage names that shape directly — "a second special case beside the first". Reconciling #metadataActions against actions itself retires all four anchors; suggested inline. I ran that form here: test_chrome_contracts.py, test_render_margin.py and test_render_navigation.py stay green, and pre-commit's prettier and eslint leave it unchanged.
previewHead no longer has a job. buildThreadCard now sets previewHead.hidden = true unconditionally, and previewItemNode hands both previewNav and previewClose to the card, so from the first card onward the node is empty and hidden for the rest of the page's life. Nothing else in the tree reads it — previewHead and .lf-margin-preview-head occur only at the construction in createMarginProjection, that one assignment, and the two chrome.css rules — which leaves the new .lf-margin-preview-head[hidden] { display: none; } a guard for a state nothing can leave. Building the two controls unparented and appending only previewList to preview drops the node, the assignment, the [hidden] rule, and .lf-margin-preview-head's half of the display: flex selector it shares with .lf-page-map-head.
Happy to push either of these as a commit if you'd rather not take the suggestion.
…he secondary ink, and update three nightly tests (#1002) Main's `nightly` job has been red since the complete suite last took a turn: [run 35837027671](https://github.com/max-sixty/leaf/actions/runs/35837027671) reported five failures on 1b4fb67. Four still reproduce on current main and are fixed here; the fifth, `test_a_stamped_live_draft_and_its_unstamped_view_keep_distinct_menu_rows`, already passes there and is untouched. Behind those four are five causes. Two are defects in shipped code — a package widget that builds a press outside the layer's press contract, and a reference link that misses AA on the ground a chosen row wears. The other three are tests still spelling a contract a merged change moved, each in a `test_render_*` module the everyday gate does not run, so the change landed green and reddened main afterwards. ## The exported corpus offers a press it cannot take `test_the_exported_corpus_stands_on_its_own` found two `button.lf-btn lf-ui` elements wearing the pointer hand in a standalone copy with no script to answer them. `data-lf-offer` is the layer's one spelling of a press: the theme hangs the hand, the hover wash and the here ring on it, and the bake reads it to decide what a file can still work. `lf-job-requests`, added with projected requests in #985, builds its Restart control with `document.createElement("button")`, so it carries no marker — and the bake's `browserControl` selector matches `button:not([data-lf-offer])`, so it read both presses as platform controls that keep working without Leaf and left them standing. What stayed was `.lf-btn`'s own paint over a control whose behaviour went with the scripts. Building it with `offer("button", "lf-btn", "Restart")` is what [`references/packages.md`](https://github.com/max-sixty/leaf/blob/895a629c7a240370bbf6c0d31c7194bdc02bcf0c/skills/leaf/references/packages.md#L442) already asks of a module — "`offer()` and `relabel()` on anything injected" — and produces the same element plus the marker, so the aim floor, the here ring and the `g` target map reach it too. The widget's own nightly case, `test_projected_request_rows_have_independent_buttons`, still passes. ## A block reference misses AA on a chosen row Behind that assertion the same test had a second failure: axe reports `color-contrast` (serious) on the `§ off-t-resync` link in the exported corpus's chosen option, at 4.43:1. It became reachable in the same window for a good reason. On the last green nightly the copy had **lost** the authored `chosen` attribute; it now keeps it. The corpus's log holds no `choose` action for that group, so the attribute is the document's initial condition and keeping it is what the markup says. The row form's ground exists precisely so a copy says which option was taken, and now it paints: `--ok-tint`. `.lf-ref` was asking for `--muted`, the document's quiet ink, which measures 4.433:1 on `--ok-tint`. `--muted-2` is the token the palette states is "held to 4.5:1 against the page surfaces it lands on", and a generated `§` reference is layer chrome rather than document prose, so that is the ink it should have been wearing. The two differ by two points per channel, so nothing visibly moves and the reading clears. Worth a maintainer's eye separately: `--muted` also measures 4.469:1 on `--chip`, so the same shortfall exists anywhere the document's quiet ink lands on a layer surface. Nothing reads it today, and widening the repair past the one element the gate names did not seem mine to decide. ## `reveal` now requires the intent its caller retained #982 removed `reveal`'s default second argument and made a missing one a `TypeError`, so no delayed caller can take a fresh intent after its wait. `test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus` calls `reveal` through `__lfRuntimeImport` to open whatever container a ring specimen sits in, and still passed one argument. That disclosure is not a reader's delayed work a later input may supersede — it is the arrangement saying what the page must show next — so it hands over the intent that always holds. ## Return submits from a Leaf composer; Shift+Return is the line break #986 moved the shared composer's submit onto Return. `test_a_growing_reply_keeps_its_send_in_the_list` grows a reply box by typing a line and pressing Enter, so each press sent that line as its own reply instead of inserting a newline. The card still overran the list — on eleven arriving messages rather than on the box — so the `assert overran` guard that exists to catch a vacuous run passed, and the failure surfaced thirty seconds later as a `wait_for_function` timeout on the Send button. The test now presses Shift+Enter and reads the reply box's own height before and after the typing, so the next time that key's meaning moves the failure names the cause instead of timing out on a symptom. ## Two commits gave a scoped chrome class a document-level face `test_a_coined_class_cannot_reach_the_chromes_rules` probes for a scoped rule leaking onto a page element, and keeps an explicit list of the classes held out of that probe because the theme dresses them at document level on purpose. #991 put `.lf-compose-placeholder` in both sheets, and #995 did the same for `.lf-action-icon`, `.lf-conversation-head` and `.lf-msg-sending` while rebuilding the margin card's sticky head. All four are the case the list already documents — the theme dresses a shared control or message part wherever it renders, while the chrome's scope only places its own copy — so the exception is widened with each one's reason, which is what the assertion asks for. ## Verification Run on this branch under Ubuntu 24.04 with `--run-nightly`: all four failing cases pass, as do `test_projected_request_rows_have_independent_buttons`, `test_the_feature_gallery_has_no_serious_wcag_a_or_aa_violations`, `test_the_adopted_sheet_decides_nothing_by_standing_last`, and `test_render_options.py` / `test_render_options_addition.py` — 74 passed, one failure. Each of the four was reproduced first on unmodified main, so none of them is the run's own noise. Pre-commit passes on the changed files. That one failure, `test_a_widget_move_keeps_one_target_seat_across_revisions_until_honored`, is not this branch's and is not in the run being fixed: it passed on 1b4fb67, and it fails identically on unmodified 895a629 — alone, under `-n0`, in 10 seconds, on `expect(receipt).to_have_attribute("data-lf-kinds", "sent")`. It is a later regression from the seven commits that landed after this run, and main's in-flight nightly will report it on its own. <details><summary>The run's five failures, and where each stands on current main</summary> ``` tests/test_render_controls.py::test_every_ring_the_layer_draws_is_shown_whole_somewhere_in_the_corpus TypeError: reveal needs the intent its gesture retained reproduced · fixed tests/test_render_conversations.py::test_a_coined_class_cannot_reach_the_chromes_rules extra: lf-compose-placeholder reproduced · three more names since tests/test_render_conversations.py::test_a_growing_reply_keeps_its_send_in_the_list TimeoutError: Page.wait_for_function reproduced · fixed tests/test_render_export.py::test_the_exported_corpus_stands_on_its_own offering: ['button.lf-btn lf-ui', 'button.lf-btn lf-ui'] reproduced · fixed then color-contrast (serious) 4.43:1 on .lf-ref behind it · fixed tests/test_render_projection.py::test_a_stamped_live_draft_and_its_unstamped_view_keep_distinct_menu_rows Locator expected to have count '4', actual 3 passes on main · untouched ``` The contrast reading was pinned against the last green nightly (00d7a41), where the same test passes and the exported chosen option computes `background-color: rgba(0, 0, 0, 0)`; on current main the same node computes `rgb(223, 237, 223)`. </details> Co-authored-by: leaf-agent <[email protected]>
Put the author and workflow label, settlement, and dismiss controls on one sticky metadata row for page conversation cards. When a passage has multiple threads, place a compact selector immediately before settlement; long workflow text truncates so the controls remain reachable.
Use the same control ownership for one or multiple threads. Opening Threads from Dismiss now carries the selected conversation in either case. Retain the native controls as the selected thread changes, preserving focus and desktop and touch targets.
Validated the initial change with 1,342 everyday tests, 157 owning browser tests, 70 runtime tests, pre-commit, and live desktop and touch previews. Validated the review repair with six focused browser cases, pre-commit, and updated single and multi-thread previews.