Skip to content

Name a section by the heading it opens with, and nothing else by a heading inside it - #6264

Merged
max-sixty merged 3 commits into
mainfrom
structured-obligation-names
Nov 17, 2026
Merged

max-sixty merged 3 commits into
mainfrom
structured-obligation-names

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Leaf now names plain markup by the caption HTML gives it: a disclosure by its <summary>, an <hgroup> by its heading, and a section or article by the heading it opens with, alone or in an opening <hgroup>. No other plain element is named by a heading inside it. titledElement, the package API that says which element a heading titles for the contents' stretches, a heading's link address and its preview's thread count, follows the same rule, plus a widget the heading leads unless the widget's label names it. Both replace longer rules that let any element take a leading heading found inside a <header>, past an eyebrow, or wherever every other heading inside ranked lower; the outline walk behind them goes. Registered widgets keep their leading-title rule until their titles move to label. A section's aria-labelledby or aria-label doesn't yet win over its heading: that follows #6256, whose group_name already reads aria-labelledby in Python, so the two runtimes share one reader rather than gaining a second.

Max picked this rule on his design page for where Leaf takes facts about a page, as the one reading of position "Read what the page states" (#6255) allows.

What to weigh: on 274 real pages, 2,373 of 2,852 sections and articles open with a heading and keep their names. 109 lose theirs: 54 open with a paragraph such as an eyebrow, which page-authoring.md already teaches to put in an <hgroup>, 28 have their heading later, 22 open with a div, and 5 wrap another section. Another 232 wrap an lf-ask and lose the question's name; #6256 makes the question itself the section. In the examples, alert-thresholds.html's six evidence articles opened with a <header>; their heading and threshold now stand in an <hgroup>, which keeps them named and measures the same.

Tests: runtime suite, test_obligations.py, a heading-link and a contents browser test. Codex reviewed it; its two findings, widget titling and chrome inside an <hgroup>, are fixed with tests, as is the auto-review's note on that example.

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

…ading inside it

Plain markup is now named by the caption HTML gives it: a disclosure by its
<summary>, an <hgroup> by its heading, and a section or article by the heading it
opens with, alone or in an opening <hgroup>. A div, aside or nav is no longer named
by a heading inside it, nor is a section whose heading follows an eyebrow paragraph,
an intro, or a header element. Registered widgets keep their leading-title rule
until their titles move to a `label` attribute.

`titledElement` follows the same rule: a heading titles its hgroup, the section or
article that opens with it, and a widget it leads, short of one its `label` names.
That replaces the outline-based reading that let any element take a heading where
every other heading inside ranked lower, past wrappers and words, so `headingsIn`,
`opensOn` and their cached outline walk go. A section wrapping a question or
another section is no longer titled by the question's heading, so a thread about
that wrapper counts under the heading before it, and the contents and a heading's
link address start at the question or inner section instead.

The maintainer picked this rule on the markup-meaning design page, as the one
reading of position root AGENTS.md's "Read what the page states" allows.
…-names

# Conflicts:
#	browser/runtime/addressable-names.js
leaf-agent
leaf-agent previously approved these changes Nov 17, 2026

@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.

Non-blocking: the six evidence articles in examples/alert-thresholds.html (#alert-rate-evidence through #alert-cert-evidence) each open with <header class="alert-head"><h3>…</h3><span class="alert-today">…</span></header>. Under this rule they lose their names, so a comment pointed at one is labelled by the part around it instead of its alert's name. The page could switch that header to an <hgroup> with the status as a <p>, as page-authoring.md teaches. It's your call whether this corpus page should demonstrate the rule.

Each evidence article opened with a header holding its heading and today's
threshold, so under the opening-heading rule it lost its name, and a comment on
it was labelled by the part around it. The heading and the threshold now stand in
an hgroup, the threshold as a subtitle paragraph, which keeps the article named by
its alert. The header's boxes and faces measure the same before and after.
@max-sixty
max-sixty merged commit 97adb94 into main Nov 17, 2026
5 checks passed
@max-sixty
max-sixty deleted the structured-obligation-names branch November 17, 2026 07:43
max-sixty pushed a commit that referenced this pull request Nov 17, 2026
…gether words (#6294)

A page's navigation tab strip (the first `lf-tabs` directly in `main`)
took its accessible name from `addressableLabel(main)`. #6264
deliberately stopped `main` and other plain elements taking a name from
a heading inside them, so that call fell through to `main`'s words run
together: the strip in
`test_a_tab_strip_is_named_as_the_chrome_names_its_set` was named "Redo
the kitchen Plan Costs Cabinets first. Under budget.…". The strip now
takes the page's authored `<title>` through `authoredTitle()`, the
runtime's existing reader for the page's title, so #6264's rule stands
and the code keeps its stated intent that the page's title names its
navigation.

`authoredTitle` is newly exported from `widget-api.js` and documented in
`module-reading.md`, because a package can't read the title itself:
`document.title` carries the On Me count while one is shown, and the
authored `<title>` is told apart from the runtime's only by an internal
marker.

Behavior change: the root strip's name is now the page's `<title>`
("Kitchen plan" in the test) rather than its leading `<h1>`. The test
now expects that. It failed on `main` and passes with the change. `pnpm
run check:browser` also passes. Strips named by their section's heading
or by `aria-label` are unchanged.

Closes #6290 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Nov 17, 2026
…, as #6264 requires (#6306)

#6264 names a `section` only by the heading it opens with, alone or in
an opening `<hgroup>`, and stops naming it by a heading found after an
eyebrow. The `LINKS_PAGE` fixture's `#stall` section opened with
`<p>offline editing</p>` before its `<h2>`, so under the new rule it had
no name, and `test_a_link_into_the_page_previews_where_it_points` saw
the preview fall back to the link's own words, "the reconnect stall".
This is what #6264 intended: its description counts 54 real sections
that open with an eyebrow and says `page-authoring.md` already teaches
putting it in an `<hgroup>`.

The fixture now wraps the eyebrow and heading in an `<hgroup>`, so the
section is named "iOS reconnect stall" again. The test's other check,
that the excerpt leaves out what's drawn before the name, still holds
with the eyebrow inside the `<hgroup>`. Product code is unchanged.

Verified locally: the journey failed on both `browser` and
`firefox_browser` before the change, with the same assertion as the
scheduled run, and passes on both after it.
`test_a_message_s_parts_follow_an_edit_the_card_held_as_news`, the other
test that uses `LINKS_PAGE`, also passes.

Closes #6300 — automated triage

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