Skip to content

Show each depth's size on the Skim control: minutes under each depth, its pages hanging under the buttons - #6612

Merged
max-sixty merged 37 commits into
mainfrom
skim-size-hover
Nov 20, 2026
Merged

max-sixty merged 37 commits into
mainfrom
skim-size-hover

Conversation

@max-sixty

@max-sixty max-sixty commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

The Skim control (lf-dial) now shows how much of the page each depth keeps. Each depth's button gives its reading time under its word. Pointing at a depth, by pointer, Tab or a finger's hold, hangs each depth's page under its own button as a separate sheet drawn to one scale. Where turning to that depth would hide text, the page fades it. A click or an arrow key keeps the sheets up while an accent frame glides to the new depth. The time is an estimate: the depth's words at 238 a minute plus 12 seconds a picture.

Two changes reach Leaf's preview, so every widget gets them:

  • Readings that stand by the same element redraw in place, so the pointer crosses the dial's buttons without a flicker. The redraw now also takes the hold mark off a control a finger slides away from.
  • A new lfPreview field, unseen, is for an element that draws its own preview. Leaf shows and ends the preview on every route, makes it Escape's first step and gives a screen reader its words on focus, but keeps the face out of sight.

What to weigh:

  • The sheets are an exception to "every preview wears one face", which the maintainer chose. The dial's header records it.
  • The sheets stay up through a turn by Leaf's existing aim: a press or an arrow key that turns the dial while they hang calls previewChanged(radio, {aim: true}), as a chart does for its next point, so Leaf's preview reads the new depth and its own rules close the sheets. The dial binds no keys of its own.
  • Pointing costs the same on any page length. The dial reads the fold plan once per presentation and marks only blocks within a window of the view. On a 500-section page, pointing at Skim went from 95 ms to under 2 ms.
  • That reading runs at upgrade, before the page first shows the server's state, so each depth's minutes appear with the control's first drawing rather than a frame later. It walks the page once: about 18 ms in Chromium and 30 ms in Firefox on a 500-section page, and about 1 ms on the incident report.
  • The minutes under each word take a new declared font, --lf-font-choice-stacked, set solid so the two lines fit a one-line control.

Max picked the design from a playground of candidates on a Leaf page and reviewed the result. The catalog previews were recaptured.

Tests: test_dial.py covers the minutes, the sheets, a press keeping them and Escape, in Chromium and Firefox. test_previews.py covers the in-place redraw. The runtime tests and check:browser pass.

This was written by Claude Code on behalf of max-sixty

Skim folded every block the author hadn't marked `.gist`, so a chart, a
diagram or a screenshot vanished from a quick pass, though a skimmer
often reads a page by its pictures. Skim now keeps each picture with its
caption: a figure, an image, an inline drawing, a video or canvas, or a
widget whose entry declares `visual` (painted `data-lf-visual`), such
as a chart. A heading stands at Skim when a lede, gist or picture
follows it, so a section whose only content for a skimmer is a picture
keeps its heading. A line of text holding a picture, or a table holding
one, stays whole rather than being taken apart, and nothing inside a
closed `details` counts, since Skim shows nothing Read doesn't (a gist
in a closed disclosure was laid out by the walk before, and its summary
folded). Pictures a Leaf element draws inside itself stay that
element's, as its children always were.

Skim stopped taking each section's first paragraph in #5588; this
change leaves the author's gists as they were.

The detail package's developer page becomes the catalog example
`incident-report`, with a latency chart in Impact that Skim keeps, and
the catalog lists it as "Incident report · Skim, then read". The
Extending page's Detail card opens it. The place journeys build the
report without its chart, the geometry they were measured on: with the
chart, the begun turn's reading line fell between two lines, and the
image that grows after the glide no longer moved the place, since the
browser anchored on the chart.

`leaf-dev site previews` checked the panel placeholder's font on the
placeholder element alone, whose words now stand in an inner span, so it
refused every capture; it reads the fonts of the element and everything
inside it.

The author instructions and registry entries change only where they
state what Skim shows; no scoring, as they correct a fact.
…tes them

Review of the previous commit found four places Skim still took a block
apart or misread a picture. The walk entered any element that held
something Skim keeps, so an open `details` holding a figure lost its
summary to a fold, and a paragraph whose words sit in an `em` beside an
image had its words folded and a ⋯ put inside it. It now enters only
HTML's sections and groups of blocks (`section`, `div`, a list and the
like) with no words of their own, and keeps anything else whole.

A picture inside any Leaf element counted as the element's own, so a
figure in a tab or an `lf-motion` folded its section, heading and all.
Now only a widget that draws its own content (`content` `data` or
`empty`) owns its pictures; one holding the author's markup stays whole
at Skim around a picture, as around a gist. What HTML marks as
decoration (`aria-hidden`, an empty `alt`, a presentation role) is no
picture, so an icon in a heading no longer keeps a gist-less section.

The record of the disclosures Everything opened is the dial's own set
again, read through a method rather than a module-level copy, and the
walk takes the dial's document once per pass instead of per block.
Not for landing as is: the maintainer picks one, and the others and the
`--lf-dial-size` switch go. Each depth's time is its words at 238 a
minute and 12 seconds a picture, measured once for each presentation of
the page.

- minutes: each depth's preview, which pointing, focus or a held finger
  shows, says "About 3 min to read" (its title moves into `lfPreview`).
- gauge: a hairline under the dial fills to the chosen depth's share of
  Everything, ticked at Skim and Read; the preview says the minutes.
- map: the preview draws the page at all three depths to one scale,
  each block a bar as long as it takes to read, pictures in blue, the
  pointed depth inked and the minutes under each.
…alog previews

Entering only sections and groups left out a list item, a definition
and a quote, so a gist in one kept the paragraphs beside it at Skim,
where before they folded: a list of findings, each a gist and its
support, showed the support too. The walk lays those out in place
again, still keeping one with words of its own whole.

The catalog previews are recaptured after the incident report's chart
and duration changed.
…o widgets

Laying out list items in place split one whose words sit in a link and
an `em` beside an image: the image stayed and the words folded, with a
⋯ inside the item. The dial read a line of text only by its own loose
words. It now reads one as an element with words of its own or a child
that stands in a line of words other than a picture, the passage
reader's `phrasing` rule (HTML's phrasing content, or a widget declaring
`inline`), and lays out in place any other plain structure except a
table or a disclosure. The list of sectioning tags the walk could enter
goes.

`phrasing` was private to passages.js; widget-api.js exports it so a
package reads the passage reader's rule rather than a copy of the tag
list, and module-reading.md says what it answers.
Counting any inline child as the mark of a line made a section holding a
gist beside a `script`, a block-level `button` or a link in its header
a line, so Skim kept the whole section, support included. A line is now
an element with words of its own, or one whose children all stand in a
line of words, as an image beside a link and an `em` does; one block
among its children makes it structure, and its stray inline children
fold as blocks do. Leaf's chrome and scripts don't count either way.
Skim kept its own list of picture tags beside the runtime's, which
decides what a reader can comment on as a picture (`visualTags` in
anchor-resolution.js): Skim counted `video`, `canvas` and `picture`,
and comments didn't. `widget-api.js` now exports `visualTags`, and the
dial reads it once at setup, so a picture is `svg`, `img`, `figure` or
a widget declaring `visual` in both. A video or canvas folds at Skim
until the runtime's list takes them, which would make each one a
comment target too. The dial keeps only its own scoping on top:
HTML's decoration, closed disclosures and widgets that draw their own
content.

`options.css` keeps its own reading in CSS, which can't call the
runtime, and counts a table as a picture for card layout.
# Conflicts:
#	packages/detail/widgets/lf-dial.js
# Conflicts:
#	browser/runtime/widget-api.js
#	packages/detail/widgets/lf-dial.js
Each way is a setting a page sets on the dial, so a playground can compose
them live: at rest (minutes beside or under each depth, or the gauge),
what pointing adds (the description, the minutes, bars to one scale, bars
cut into the page's blocks, or the page map), whether pointing fades on
the page what the depth would hide and tints what it would open, and
whether each fold mark says how long its gap takes. The map takes the
preview's ink rather than fixed greys. A bar in each depth was tried and
dropped: it read as an underline, a switch or a caret.
The bars then say only each depth's share, and the minutes under each
word say its size. Pointing at a depth now marks where it would open
more in the accent's ink alone: the tinted ground read as a selected
row or an empty button.
keeps and keepsText already write only what changed; a style property
set to the value it holds is no write, so it needs no guard.
Accent ink alone read as a link; a dashed contour is the mark Leaf keeps
for a state not yet taken.
The maintainer asked for a hover anchored to the dial that shows each depth's
bar under its own button, with the three buttons made one width. The dial's
`point` setting gains `hang`: a panel the dial draws under itself, each
depth's page under its button to one scale, the pointed one in full ink, and
under them what the pointed depth shows. The three depths now share the
widest one's width (a grid of equal columns in the radio group's row).

The panel is the dial's own rather than Leaf's preview face: Leaf's preview
keeps clear of the page's controls, so with a link under the dial it stood
the columns beside the control, away from their buttons. The dial previews
for all three depths at once in this mode, opening and closing the panel with
its preview (pointer dwell, focus, a finger's hold, Escape), whose own face
stays unseen. The other point settings keep their per-depth previews.

preview.js: a pointer moving onto another part of the element whose preview
stands, where that element still speaks for the part, is now a new aim inside
it, as a chart's next point is, and redraws in place. Before, crossing from
one radio to the next ended and re-showed the preview, so the panel blanked
and its pages regrew on 50 of 120 sampled frames; after, none.
…e element

A preview's next reading on the same route that stands by the element the standing
one stands by, its declared `at` or its declarer, now takes the standing one's place
with no fade: `show()` decides it from the reading, for the pointer and a finger's
slide alike, and `point()` shows the next target at once over a standing preview
instead of hiding it first. This replaces the pointer-only `aimsInside` rule, which
keyed on one declarer and left a sliding finger closing and reopening the preview
at each control, and could take a focus or hold show over a pointer preview in place.

The pointer route now reads the next target before the last one's reading ends, as
focus and a hold already did; the contract allows that order (`detail.declared`).

The dial's hanging pages go back to one preview per depth, each standing by the dial,
so crossing the buttons is one in-place redraw and one read. That deletes the dial's
own declaration, its record of the aimed depth, a listener on each button and its
`previewChanged` call, which together read the dial three times per crossing. Each
depth's ending now takes back its marks only for the reading it declared, which fixes
the panel closing while its unseen preview stood after a finger slid between depths or
the pointer rested on a depth keyboard focus had previewed.

Measured with leaf-dev probe on incident-report in hang mode, Chromium and Firefox:
mouse crossings log one read and the last depth's ending, with the panel open
throughout; a finger slide and Tab-then-pointer keep the panel open; Escape and the
pointer leaving close it. The two new tests fail on the base runtime.
…pages under the pointer

A preview's placement memory now keys on the element it stands by, not the target
whose reading it draws, so a next reading standing by the same element keeps the side
and corner the last one stood at, as a new aim and words that grow already did. Before,
crossing from a one-line reading to a six-line one near the window's foot placed the
face afresh and flipped it above the row without closing it.

The dial's hanging pages are the preview's face, but nothing on them or in the gaps
between the depths previewed, so the pointer moving onto them counted as leaving and
closed them within a dwell. In hang mode the dial now reads the depth last pointed at
again there, standing by the dial as each depth's reading does, so they stay open in
place (leaf-dev probe on incident-report, Chromium and Firefox: open at 620 ms on the
panel, closed on leaving and Escape as before).

The crossing test now also holds the face's side; it fails on the previous runtime.
…mes pictures itself

main (#6578) removed the dial's picture-tag list and `visualTags` from the widget
API. The size prototype's Skim sizes now follow main's rule (`#kept`); it still times
each picture at 12 seconds, with its own selector for what draws rather than says.
…al's pages as separate sheets

A press puts a pointer's preview away, as the platform's tooltip goes. A press
inside the element around the target that its reading stands by (`at`) now keeps
it: picking one of a widget's controls changes what their shared preview shows
rather than leaving it, and the widget's `previewChanged` at that element reads
it again in place. The platform light-dismisses a hint on any press outside it,
which no event cancels (checked in Chromium and Firefox), so the preview opens
its hint again where it stood. Only the dial declares `at` around its controls
today. New test: test_a_press_inside_the_element_a_reading_stands_by_keeps_it,
which fails on the prior runtime in both engines.

The dial's hanging pages (prototype) are now three sheets of their own with the
page showing between them, a caption naming the pointed depth under them, and an
accent frame on the depth that stands, which glides to the one a press picks.
The maintainer asked for see-through gaps and for the pages to stay up on click.
Review of the last commit found the runtime rule (a press inside the element a
preview stands by keeps it) misfired: a kept press that opened a popover had the
re-shown hint over it and took the first Escape; a popover opened by script after
any kept press got the hint back over it; modified presses kept it. All came from
re-opening a hint the platform light-dismissed, a second dismissal rule laid over
the platform's. This reverts preview.js, its contract sentence and its test to
the parent's, so a press puts every preview away again.

The dial keeps its own pages instead, since they are its own panel: a plain mouse
press or an arrow key on the dial keeps them while Leaf's preview goes, the dial
putting its panel away a frame after Leaf's preview ends unless kept. Kept pages
go as the pointer leaves the dial (after a 200 ms dwell), at any other key, or at
a press elsewhere. A sheet now takes its button's press and points its depth, and
the panel meets the dial's edge so the pointer moving onto the sheets never leaves
the dial. Probed in Chromium and Firefox: no frame without the panel through a
press, arrow keys keep it, Escape, Alt-click and leaving put it away.
…us leaves

Second review of the dial-owned keep-up: Escape put the pages away in the dial's
own key listener without consuming it, so Leaf's Escape also ran and took focus
from the radio to the body; a modifier alone dropped them, where Leaf's preview
ignores one; a revision applied in place left them showing old sizes; and after
a press the pointed depth waited out Leaf's dwell crossing the buttons. Escape is
now the dial's command, available while the pages are kept; any other key no
longer drops them, focus leaving the dial does (onCurrentLocation); a revision
redraws them; and kept pages point at a button as the pointer reaches it.
Probed in Chromium and Firefox.
… picks

Third review pass: removing the any-key drop left the kept pages over the page
while `j` scrolled it, and a press on a sheet left focus on the body, where the
dial's Escape row can't be reached. Any key but Escape and a modifier alone
(`getModifierState(key)`, no copy of Leaf's list) now puts kept pages away, as it
does Leaf's preview, and a sheet's press focuses its depth's radio as the
button's own press would. Probed in Chromium and Firefox.
…ging under the buttons

Max picked, from the playground of size displays, minutes under each depth's word at
rest and, on pointing, each depth's page hanging under its own button to one scale,
with the page fading what turning there would hide. The other displays and their
settings go: minutes beside the word, the gauge, the bars, strips and map in Leaf's
preview face, and minutes on each ⋯.

Following his review of the hanging pages:

- The caption chip under the sheets goes. Its box stood 40px past each side of the
  dial so a long description could centre unwrapped; in the decision page's 610px
  sample the dial stands at the column's end, so the box ran 16px past the window
  and pointing at a depth made the page scroll sideways, which macOS answers by
  flashing its scrollbars. Without it, pointing changes no scroll extent.
- The sheets drop together in the disclosure's time rather than one after another,
  and the frame fades in with them: browser/AGENTS.md rules out a staged reveal.
- A sheet no longer takes its button's press, since a preview holds no control;
  pressing one keeps the sheets.

Leaf's preview gains `unseen`, for an element that draws what pointing at it shows
itself: Leaf shows and ends the preview on every route, makes it Escape's first step
and gives a screen reader its words on focus, with the face out of sight. The dial
used to hide the face with a rule on Leaf's `.lf-preview` from its package sheet.

The two-line depth labels are set solid to a one-line control's height, so the dial
stays 40px tall, the room its first paint reserves, where they made it 46px and
moved the page at upgrade.
Pointing at Skim on a 500-section page took 95ms: each pointing walked the
page for the blocks Skim folds and marked every one of them, and each sheet
drew a bar for every block, three sheets of 2,000 bars. Root AGENTS.md holds a
hover to the same cost on a page of ten sections as of five hundred.

The dial now reads, once for each presentation of the page, the blocks Skim
folds and the closed disclosures, beside each depth's time. Pointing marks
only those within a window's height of the window, found by halving their
document order. Each sheet draws its blocks in rows of one line and its gap,
at most a bar a row, a heading or a picture a row at least. Pointing at Skim
there now takes under 2ms, as on the incident report; the reading once per
presentation takes about 14ms there, with the other owners of a presentation.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The in-place path in show (standsBy) skips the hide() that used to clean up the previous record. For a finger hold, that means the previous holder keeps data-lf-held. Take a finger sliding from Skim's button to Read's: both stand by the dial, so Read's reading takes the standing record's place. Read's radio gets data-lf-held, but nothing removes it from Skim's. When the finger lifts, hide() clears only the current record's holder, so Skim's radio stays marked. That breaks the header's promise that the held target wears data-lf-held while its preview stands. Anything that reads the attribute (margin-layout.js, HELD) keeps treating that element as held until the next thread presentation's renderHolds happens to sweep it. On the dial nothing shows, but the in-place path applies to every widget whose controls stand by one element.

Comment thread browser/runtime/preview.js Resolved
…t by keys of its own

The dial kept its sheets up after a press with a state of its own, closed by a
keydown listener, a location watch, a press listener on the document, a
leave timer and an Escape command. A keydown outside the register broke the
rule that every key enters through it. Leaf already offers what the dial was
rebuilding: `previewChanged(element, {aim: true})` is how a widget says the
user aimed at something new inside it, as a chart's key reaching another
point, and Leaf then shows that preview whatever put the last one away. So a
plain press on the dial, or an arrow key in its depths, while the sheets hang,
aims at the depth it reached; Leaf's preview reads it again and the frame
glides there. Escape, any other key, a press elsewhere, focus leaving and the
pointer leaving all end the sheets as they end any preview. The sheets wait
for a press to lift before going, since Leaf hears the press go down first and
its click is what reads the depth again.

Also from CI and the bot's review:

- The in-place redraw left `data-lf-held` on the control a finger slid off,
  since only `hide` took it off. The redraw now takes it off a holder it
  leaves.
- The dial's marks are `data-lf-open` and `data-lf-pointed`, under Leaf's
  prefix.
- The dashed ring stands at a control's gap, and rings the ⋯ marker rather
  than restyling the press inside it.
- The two lines in each depth keep their declared fonts and stand in a
  one-line control's height with only their leading past its padding.
- module-input.md stays under the 30,000 characters a Bash read returns
  whole.
leaf-agent
leaf-agent previously approved these changes Nov 20, 2026
…ses through onPress

From an independent review of the shipped dial:

- Firefox drew almost none of a sheet's text lines: a repeating gradient
  whose stop is `color-mix(…, transparent)` drew nothing in a bar 6 rows or
  taller. The stop is now `rgb(from currentColor r g b / 30%)`, which draws
  in both engines.
- Under about 364px, three columns as wide as "Everything" broke it mid-word
  and, before upgrade, overflowed a 320px window. Each depth now keeps its
  words whole and shares what is left, and the dial and its first-paint
  measure take no more than the column.
- The two lines in each depth take a declared font, `--lf-font-choice-stacked`,
  set solid so they fit a one-line control, which grows with larger type
  rather than letting the minutes cross its border.
- The dial follows a press through `onPress` from focus.js rather than its
  own document listeners.
- The page fade takes the disclosure's motion token and stops under reduced
  motion.
- The test holds a press for 150ms and checks the sheets stay up throughout;
  an instant click passed even with the press handling removed.
- module-input.md says an unseen preview's words still describe what has
  focus.
A tap held the sheets through its press like a mouse's, but nothing reads a
finger's preview again after it lifts, so for a few frames the sheets showed
the old depth ringed after the dial had turned. A touch press now leaves
them to go as Leaf's preview does.

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The new press step in test_pointing_at_a_depth_hangs_each_depth_s_page_under_its_button runs expect after page.wait_for_timeout(150), so test_no_assertion_rests_on_a_sleep (tests/model/test_suite_source.py) fails at this head and the test job will go red on it. The sleep also doesn't prove what the step claims. On a slow runner, an unfixed dial could still have its sheets up 150 ms after the press, so the step would pass with the bug present. What the step needs to rule out is the sheets going one rendering update after the press goes down (#ended defers by nextRender). That is the case tests/AGENTS.md allows a frame count for, so one_frame(page) from leaf.render_checks states the ordering. The suggestion below also needs from leaf.render_checks import one_frame among the test file's imports.

Comment thread tests/browser/widgets/test_dial.py Resolved
…eets

The sheets would go a frame after the press puts Leaf's preview away, so two
frames are the claim; a sleep could pass on a slow runner with the bug
present (tests/model/test_suite_source.py).
@max-sixty
max-sixty merged commit 340aa44 into main Nov 20, 2026
6 of 7 checks passed
@max-sixty
max-sixty deleted the skim-size-hover branch November 20, 2026 20:09
max-sixty pushed a commit that referenced this pull request Nov 21, 2026
…changed (#6660)

Four of the failures in scheduled `ci` run
[44896279165](https://github.com/max-sixty/leaf/actions/runs/44896279165)
on `c72a8ad03` are tests that weren't updated when a recent change moved
what they read. None of them catches a defect a user would see, so each
fix updates the test and keeps what it asserts. Each test failed locally
on `c72a8ad03` and passes with this change.

- **`test_the_page_holds_still_under_the_user[dial-*]`** (8 cases, Linux
and macOS). #6612 put each depth's reading time under its word, so the
dial's radios are now named `Skim 2 min` and so on. `turn()` was still
waiting for a radio named exactly `Skim` and timed out after 120 s. It
now matches `^Skim \d+ min$`, the same pattern
`tests/browser/widgets/test_dial.py` uses. The six cases now pass, and
the two `dial-grown-after-glide` cases fail as their `MOVES_ON_MAIN`
entry expects.
- **`test_a_link_s_preview_shows_only_what_the_page_draws[browser]`**
(teardown error, Linux and macOS). #6654 wraps each line of a
reading-face `<pre>` in a `<span data-lf-pre-line>`. That means `#code >
span` now selects the first line's wrapper rather than the hidden span.
The `COPY CONTROL` words the test inserts after it became an extra line,
which pushed the rows below down 20 px with no input, and the shift
watch reported that. The test now inserts the words after `#code
span[style]`, the hidden span it meant, so they stay on the first line.
- **`test_every_restore_case_a_user_can_return_to_is_arrived_in`**
(Linux and macOS). #6641 adds ` (fails the check so that …)` to each
finding. The test split the `returned holding a,b` list on commas only,
so the suffix stuck to the last key. Whenever storage listed the restore
case's own key last, the parse dropped it. The order of keys in storage
is what made this pass locally and fail on CI. The test now reads the
list up to the first space.
- **`test_arrangement_retains_linked_pages_per_phase`** (`dev-tests`).
#6640 stopped Leaf writing `target="_blank"` over cross-origin links.
The test's authored links now open in the same tab, so `expect_popup`
timed out. The test now follows both links in place and checks the
restored addresses and the kept decision as before.

Refs #6659 — automated triage. The report's other failures are owned
elsewhere: the long-thread card width is #6139, the Firefox
`ResizeObserver` loop is #6604, and the macOS-only failures are tracked
in their own cause issue.

Co-authored-by: leaf-agent <[email protected]>
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.

2 participants