Skip to content

Advise when a drawing's fit shrinks its labels below 10px - #1197

Merged
max-sixty merged 5 commits into
mainfrom
drawn-text-check
Sep 26, 2026
Merged

max-sixty merged 5 commits into
mainfrom
drawn-text-check

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

An eval dashboard's hand-drawn SVG was fitted to its box until its labels were a few pixels high, and version check --render passed it. The gate now reads, at the 1200px desktop viewport, the drawn size of each SVG label the browser paints (set font-size times its screen scale; words in <defs> or under a hidden <tspan> are not counted) and advises, per drawing, when a label is drawn below 10px and smaller than it was set. Advice rather than a failure, since the fix is a composition choice; a label set small on purpose, and widgets that keep their renderer's natural size, never trip it.

Over the 24 corpus pages it flags two, both rightly: the rust-sort and wt-merge films draw labels at 6–7px. The eval's own case shrank only at 900px and on a phone, which the widths item in TODO.md covers.

Test: test_a_drawing_fitted_until_its_labels_are_unreadable_gets_advice_and_still_passes.

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

🤖 Generated with Claude Code

max-sixty and others added 3 commits September 25, 2026 15:30
An inline SVG drawing is scaled to its box, labels included, so a wide
viewBox in a column draws its 11px labels at a few pixels and nothing in
the source says so. An eval's dashboard went out like that with a passing
render check.

The new `shrunkLabels` probe reads each SVG <text> run at its drawn size
(computed font-size times the vertical scale of its screen CTM) and
reports one entry per outermost <svg>: how many labels the fit took below
10px and the smallest, with the size it was set at. It counts a label only
when the fit made it smaller than it was set, so the theme's 9px step
glyph at natural size, and widgets that keep their renderer's natural
size (lf-diagram, lf-chart), stay clear.

`version check --render` reports it as advice at the 1200px desktop
viewport, beside the alignment and margin-pin advice; it refuses nothing.
authoring-evidence.md tells authors to draw the viewBox near the width it
is shown at. Over the corpus it advises on two page-owned films, rust-sort
(6px) and wt-merge (6.8px), and fails nothing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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 visibility filter can advise on labels that are never drawn. In Chrome, a <text> inside <defs> passes checkVisibility() and has a screen CTM, but has no painted rectangle. A hidden <tspan> inside a visible <text> reaches the text-node loop too. A fitted SVG can therefore report unreadable labels that the user cannot see. Check for a rendered rectangle at both levels before counting a label.

shrunkLabels asked visibility of the <text> and then read every run of
words inside it. Chrome passes checkVisibility() for a <text> in <defs>
and gives it a screen CTM, and a visible <text> can hold a <tspan> that is
display: none or visibility: hidden, so a fitted drawing could be advised
about labels nobody sees.

The probe now asks each run's own holder, the <text> or <tspan> that
Chrome lays out and paints: it needs a client rect (none in <defs> or
another unrendered subtree, none under display: none) and must pass
checkVisibility with visibility and opacity. The scale comes from that
holder's CTM too. That rule replaces the <text>-level visibility check,
the `closest("[hidden]")` guard (an HTML `hidden` ancestor is display:
none; on SVG elements Chrome draws the words anyway, so the guard skipped
drawn labels), and the null-CTM guard, which Chrome never hit.

The render-gate test gains a fourth drawing fitted like the squeezed one
whose only words sit in <defs> and in a display: none tspan; it draws no
advice. A visibility: hidden tspan is kept out of the fixture because
paperVoids rightly fails it in print.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Sep 26, 2026
# Conflicts:
#	skills/leaf/assets/AGENTS.md
@max-sixty
max-sixty merged commit b7279e6 into main Sep 26, 2026
5 checks passed
@max-sixty
max-sixty deleted the drawn-text-check branch September 26, 2026 01:03
max-sixty added a commit that referenced this pull request Sep 26, 2026
#1197 added the label-size advice beside the sweep this branch split out, so
once() now reads the labels, then sweeps and reads overflow and stacking from
one set of widths. #19 drops the drawn-text and stack-width items the two
PRs settle, and the TODO widths item names what still reads one width.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 26, 2026
All three Leaf queues in the arrangement eval chose `lf-grid
columns="1fr 2.4fr"`, which stacks at the user's 900px window, and no
author could see it. The render check now advises, for each template
grid that stacks in a window 800px or wider, the window width it stacks
below, e.g. `<lf-grid id=queue> stacks into one column in a window
narrower than 854px`.

The grid's need comes from `lf-grid.js`'s own `stackWidth`; the window
is interpolated from the existing 360–1200px sweep, since how a grid's
width follows the window is piecewise. No new viewports. The probe keys
each grid by its document-order index, so two grids that share a name
(id-less grids a module writes) are read apart across the sweep.

A board is the one template that stacks in a desktop window by design:
in `3fr 1fr` the triage board shows all four columns at 1200px and
stacks below 1000px, where it takes the page's width; in `2fr 1fr` it
cuts its fourth column at 1200px and shows one at 900px.
`page-authoring.md` keeps `3fr 1fr` for a board and now says it stacks
below 1000px on purpose, so the advice the triage-board example draws is
expected.

With #1197 merged, #19 in `notes/workspace-followups.md` drops the
drawn-text and stack-width items the two settle, and the `TODO.md`
widths item names what still reads one width.

Tests:
`test_a_template_that_stacks_in_a_desktop_window_gets_advice_naming_the_window`,
`test_two_templates_sharing_a_name_each_get_their_own_stacking_advice`.

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

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[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