Repository navigation
Previews: a line cut short ends in the clamp's ellipsis, inside its room - #5615
Merged
Merged
Conversation
…tted to Where the room ends between two blocks of a preview, `fit` kept the block before whole and then wrote "…" after its words. A last line that nearly fills the face's width can't take the "…", so the browser wrapped its last word with it onto a line the room doesn't hold, which showed half clipped: with a 40 px room, a kept line of 13.8 px measured 27.6 px with the "…", in both engines. The next fit then read the block one line taller, so a refit could decide differently. That block is now clamped to the lines it has and ends in the line clamp's own ellipsis, as the block the room ends in already does. A line of no height after its words (`data-lf-cut`, chrome.css) gives the clamp something to hold back, so the ellipsis draws on its last line, truncating a full one, without wrapping it or adding to its height or scrollHeight, and `fit` decides once from what the block lays out whole. The line's `line-height: 0; font-size: 0` is what both engines draw the ellipsis for without counting it: with `overflow: hidden` Firefox counts no line and draws none, and with any height Firefox adds it to scrollHeight. Tests: `test_a_line_that_ends_in_an_ellipsis_keeps_to_its_room` shows a plain element's preview in a 40 px room whose first line of detail fills all but less than an ellipsis of the face, in both engines: the kept line stays one line inside the room, clamped, as it shows and after the page presents again. It fails on main in both.
leaf-agent
approved these changes
Nov 6, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 6, 2026
…5615) Main's `fit` now clamps the block before a room's end to its own lines, so the "…" no longer wraps its last word past the room. On a phone, where a link's card is held to the 40 px between the link and the place below it, the cut paragraph stays one line ending in the clamp's ellipsis, in Chromium and Firefox alike. The merge was clean.
max-sixty
added a commit
that referenced
this pull request
Nov 7, 2026
…nd them (#5629) Five PRs landed on `main` without the full push suite: #5614 (the preview owner), #5615, #5616, #5618 and #5617. Main's push `ci` run at 4248d1f ([42246533122](https://github.com/max-sixty/leaf/actions/runs/42246533122)) fails about 50 tests that the run at its parent 62cb54f ([42203695127](https://github.com/max-sixty/leaf/actions/runs/42203695127)) passes, and they still fail at ef6c01e ([42320062138](https://github.com/max-sixty/leaf/actions/runs/42320062138)). Run singly here, every one of them but three fails at 84d9186 and passes at 62cb54f; the three are at the end. This branch fixes the code where the PRs did something worse for a user than their own rules say, and updates the tests that asserted behaviour the PRs replaced on purpose. ## Code: three gaps between #5614's rules and its code - **A thread card previewed its own name.** `preview.js` counted every element wearing `data-lf-offer` as a control, and Leaf writes an empty one on chrome that presses nothing. A pointer resting anywhere in a thread card showed "Thread, Keep this review note…" over the words it repeats, and a `t` walk landing on a card already on the page showed it too, which took the Escape that lets go of the thread. A control is now any native or ARIA press (`PRESSES`, `control-selectors.js`), ranges and selects included, or a custom control whose `data-lf-offer` names its press (`PRESSABLE`). Thread cards, messages, resolved groups, toolbars and status or layout chrome preview nothing of their own; an element's own `lfPreview` is read either way. `test_a_range_and_a_select_preview_their_names_and_a_thread_card_none` holds both halves in both engines. (The branch's first try at this used `PRESSABLE` alone, which also dropped the previews of Leaf's own ranges and selects, since they wear an empty `data-lf-offer` too.) - **A reaction's disclosure took an extra Escape.** Enter on a reaction's glyph puts the user on its revealed Undo with a `move`, which `preview.js` reads as the user's own move, so the Undo previewed and the first Escape only put that away. `keyboard/AGENTS.md` ("Escape") says focus a surface places as it opens costs no Escape. The disclosure now says it opened (`layerOpened`) before placing focus. - **The command reference stopped running Resolve and Copy message.** #5614 made `r` and Mod+C press the thread's Resolve and the message's Copy as their `control`, with no `run`. The reference's own reading of which rows it can run left that case out. It now runs what the row's key runs, the control's press included. On the PR walkthrough exactly those two rows change. ## Tests: behaviour the PRs replaced on purpose - **Titles became previews.** Leaf's controls write no `title` on Leaf. Tests that read a held-news notice's label as its accessible description, or a title on an All pages row, a diff row's path, an On me choice or the joined notice, now read the element's preview declaration (`expect_preview_words`). - **A focus preview is Escape's first step.** Tests that expected one Escape to close the surface a focused control stands in now put the preview away first, with a new `put_preview_away` helper, then assert the step they protect. The inline sites #5614 and the key-scope commit wrote use the helper too. - `test_key_scopes.py`'s two tests: the branch's first commit, as before. - `test_an_age_previews_its_clock_time_in_the_reader_s_zone` (#5618) passed only through the thread-card name preview above. It now asserts the keyboard's clock-time preview stays visible, on the focus route, with its words, while the pointer rests on the message. - Four nightly journey tests read the same titles: `test_render_anchors`, `test_render_threads` and `test_website_server` now pass. ## Still failing, and why - `test_obligation_contextual_bindings_are_independent_of_widget_bindings`: #5614 made a control's `aria-keyshortcuts` the union of every key that presses it (`controlShortcuts` in `scopes.js`, `reflectElementShortcuts`). It now names `x` and `y` on the obligation, where only `3` reaches the control, and `x` where a nearer dead declaration takes `x` from it. `bindings.js` still says the attribute describes the dispatcher's currently reachable routes, nearer reservations included, while `control-keys.js` says every key chip's key is in it. Which contract holds is a decision; the test is unchanged. - `test_a_playground_opens_its_instruction_over_the_page`: after the preview on the instruction's Copy is put away, the next Escape leaves the instruction popover open and only the one after closes it. The lost Escape reproduces in a probe at 84d9186, and is being fixed on a separate branch. - The three Leaf-fold tests in `test_render_floating_panel.py`, and `test_threads_holds_a_row_that_joins_or_moves_behind_a_notice` (since #5618): each passes its assertions and errors at teardown, because the shift watch reports the preview's words moving without input as the preview rides its traveling target. The preview follows its target natively (`position-anchor: auto`, `showPopover({source})`), but the watch finds anchors only by name. Teaching the watch the implicit anchor didn't remove the finding. - `tests/journeys/test_render_files.py::test_file_editor_saves_quietly_and_preserves_inflight_edits`: passes its title step now, and since #5617 fails earlier: the editor's gutter moves without input after an external file update. Not traced further. - #5617's own push run ([42343843769](https://github.com/max-sixty/leaf/actions/runs/42343843769)) hadn't finished, so its breakage beyond the file journey is unknown. Two candidates are not from these PRs: `test_a_changed_diff_file_keeps_its_sideways_reader` and `test_trace_tree_opened_by_the_browser_keeps_its_match` each failed in one run only and pass singly at 84d9186, as does `test_tab_at_a_control_scrolled_away_goes_on_in_the_column_the_pointer_is_in`. ## Checks - Each changed browser and journey test, singly, at the branch head: passes, both engines where a test takes one, except those listed above. - The preview, reference, key-scope and reaction tests near the code changes, singly: pass. - `leaf-dev probe --base`: the notification playground's slider previews "Concurrent release events" in Chromium and Firefox, and the motion playground's Time slider and speed select preview as at 84d9186. - `pnpm run check` and `pre-commit run --files` on every changed file: pass. > _This was written by Claude Code on behalf of max-sixty_
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.
A preview held to a short room could show a half-clipped line under its last kept one. Where the room ended between two blocks,
fitkept the block before whole and wrote "…" after its words; when that block's last line nearly filled the face, the "…" wrapped the last word onto a line the room didn't hold, and the next fit measured the block a line taller and could decide differently. The link previews branch hit it on a phone, where a card is held to the 40 px between a link and the place it previews.Now the block before the room's end is clamped to the lines it has, like the block the room ends in, and ends in the line clamp's own ellipsis, decided in the same pass. A line of no height after its words (
[data-lf-cut]::after,chrome.css) gives the clamp something to hold back, so the ellipsis draws on the last line without wrapping it or changing its height orscrollHeight. Onlyline-height: 0; font-size: 0does this in both engines: withoverflow: hiddenFirefox draws no ellipsis, and with any height Firefox adds the line toscrollHeight.test_a_line_that_ends_in_an_ellipsis_keeps_to_its_roomreproduces it with a plain previewing element in a 390 px window and a 40 px room, a first detail line sized to fill all but less than an ellipsis' width; on main it fails in Chromium and Firefox (the kept line measures 27.6 px against 13.8 px and ends past the face). It passes now, as the preview first shows and after the page presents, and the other room-holding preview tests, the margin marker, trace timeline and numbered-moments tests pass.