Skip to content

Mark a drawing's part that draws no shape, and call a drawing's part a figure - #6332

Merged
max-sixty merged 4 commits into
mainfrom
chart-element-comments
Nov 18, 2026
Merged

max-sixty merged 4 commits into
mainfrom
chart-element-comments

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

An id on an element of a page's own inline SVG already makes that element a comment target, so a chart drawn in the page lets the user comment on one bar, label or key entry. On the sparkjoy release page's matplotlib charts, inlined in a probe, two things made those targets hard to use, in both Chromium and Firefox:

  • A part that draws no shape of its own showed no mark under the ⌥ aim, its trace or its open thread. That covers a chart's axis labels and key entries, which draw only words, and markers drawn by <use>, as matplotlib draws its dots. The SVG mark rule strokes a part's shapes and turns the outline off, so such a part now keeps the outline round its box that words wear elsewhere, standing on its edge since a chart's labels and dots stand closer than a control's gap, and its words keep their colour. Shapes inside <defs> don't count as drawn.
  • The comment box called the part by SVG's element name and the figure's caption, as in "§ g · Each bar, y label and key entry has an id". Every element of an inline drawing is now a "figure", so a part with an aria-label reads "§ figure · Key: list prices, and S, assumed".

To weigh: the outline rule uses :not(:has(… :not(defs *))) under the existing :where(svg) ancestor key; the selector-cost tests pass. Recolouring the words was tried first and dropped, since the trace's grey ink made a label look disabled.

Max asked, on a comment on the release page, whether a comment could select one element of a chart. Before/after stills and a live chart to try are on the Leaf page that answers it.

Tests: the authored-drawing aim test now covers a words-only part, a <use> marker and the label; a runtime test covers the word. Both fail on main.

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

…a figure

An id on an element of a page's own inline SVG already makes that element a comment
target. Two things made such a target hard to use on a chart:

- A part that draws no shape of its own showed no mark under the ⌥ aim, its trace or
  its open thread: the SVG mark rule strokes the shapes a part draws and turns the
  outline off. That covers a chart's axis label or key entry, which draws only words,
  and a marker drawn by `<use>` from a shape in `<defs>`, as matplotlib draws its dots.
  Such a part now keeps the outline round its box that words wear elsewhere, its words
  and marker keeping their own colour. Shapes inside `<defs>` don't count as drawn, so
  the first dot of a matplotlib series, which holds the marker's definition, is
  outlined like the rest. Recolouring the words instead was tried and dropped: the
  trace's grey ink made a label look disabled, and the accent barely differs from black
  text.
- The comment box and Threads called the part by SVG's element name, "§ g · …". Every
  element of an inline drawing is now a "figure", as a diagram's box is its "diagram".

Found on the sparkjoy release page's matplotlib charts, inlined in a probe: in
Chromium and Firefox the y labels, key entries and dots showed nothing when aimed, and
the comment read "§ g · <the figure's caption>".
At a region's 6px gap, the outline round a chart's key entry touched the label below
it, and the box round a 7px dot took in the next dot. A chart's labels and dots stand
closer to each other than a control's gap, so the outline now stands on the part's
edge, as tokens.css's "Where it stands" gives a box whose neighbours stand that close.
…m on it

Found while aiming the bars of the sparkjoy release page's sensitivity chart, which
matplotlib draws as 6px-stroked lines: Chromium's box for them is 0px tall, Firefox's
8.5px, and Leaf stands the aim only on a box with area.
@max-sixty
max-sixty merged commit 8aa5d47 into main Nov 18, 2026
5 checks passed
@max-sixty
max-sixty deleted the chart-element-comments branch November 18, 2026 01:25
leaf-agent added a commit that referenced this pull request Nov 18, 2026
#6332 and #6344 (#6343)

Push run
[44218332042](https://github.com/max-sixty/leaf/actions/runs/44218332042)
on `25e18501f` failed three tests that changes since the last diagnosed
run broke. Each test expected behavior that a merged change deliberately
moved, so this PR updates the tests and leaves the runtime as `main` has
it.

- **`test_a_board_says_which_column_each_card_is_in`: snapshots
updated.** #6325 put a board card's title back in the author's leading
`<strong>`, and #6344 deleted `quietWord`'s title lookup, so the
screen-reader-only provenance word sits at the card's start. The
snapshots now read the title as the `strong` it is, with "my change"
before it after a move.
-
**`test_a_drawing_names_its_proxies_and_keeps_its_place_among_the_page`:
test updated.** #6332 calls every part of an inline drawing a "figure",
so the proxies now read "Responses to figure · Gallery".
- **`test_page_search_finds_a_shipped_options_chip_and_title_apart`:
test deleted.** It searched the shipped `lf-options` example for a title
and a chip with no text between them. Since #6325 the chips come before
the title, with an authored space between them, so the example no longer
has such a pair. The option-chip case of
`test_page_search_finds_words_css_draws_apart_with_nothing_between_them`
still covers a chip and a title with nothing between them.

The quiet word now comes before a card's title, so a screen reader hears
"my change Squirrel baffle". Placing it after the title without reading
`<strong>` as a title is a question for the maintainer and isn't part of
this repair.

The first two tests fail on `main` and pass on this branch locally. The
fourth failure in the run,
`test_a_root_summary_keeps_thread_actions_outside_its_fold[1440-False-2]`,
is #6139, which is assigned to the maintainer.

Refs #3985 — automated triage

---------

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