Skip to content

fix: keep main's heading from naming every unnamed element on the page - #5506

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5475-label
Nov 5, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-5475-label

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

Since #5228, a page whose main leads with an <h1> lends that title to every element on the page with no name of its own. The s hints announce div: Split for a wrapper whose words are its two paragraphs, a chosen list is announced by the page title, and a draft's edit button reads Edit “Draft source” instead of Edit the draft. This restores the pre-#5228 naming.

Cause. addressableLabel (browser/runtime/addressable-names.js) names an unnamed element by the nearest enclosing name, climbing "short of the document it stands in (the page's column, or a message's body)". The climb stops at authoredScope, which #5228 widened from main to body so content beside main belongs to the page. That moved the stop one level up, so the climb now asks main itself, and main's leading heading is the page's title.

Change. The climb also stops at main, the direct child of body. Content beside main, such as a site header, still climbs to body, and a message body is unaffected. The Python side (gesture_words.element_name) doesn't climb, so it needs no change.

Tests. These failed on main and pass with the change:

  • tests/browser/test_render_semantic_selection.py::test_a_boxless_target_is_read_where_it_paints
  • tests/browser/test_render_semantic_selection.py::test_dense_selection_hints_stay_short_and_reach_an_atomic_visual
  • tests/browser/test_render_pages.py::test_ship_review_summary_is_addressable_and_baseline_aligned
  • tests/browser/drafts/test_draft_editing.py::test_a_draft_uses_shared_editing_and_saves_exact_markdown_source

A new case in tests/runtime/addressable-name.test.mjs puts a leading <h1> in main and asserts that it names nothing main holds. It fails without the fix and passes with it.

#5475 lists twelve tests broken by #5228. Together with #5505 (merged, two tests) and the aim test update, this leaves five still under diagnosis there.

Refs #5475 — automated triage

An element with no name of its own takes the nearest enclosing element's
name, short of the document it stands in (`addressableLabel`). #5228 widened
that document, `authoredScope`, from `main` to `body`, so the climb now asks
`main` itself, and a page whose `main` leads with its `<h1>` lent that title
to every unnamed figure, list, div and draft: the `s` hints, the chosen-target
announcement and a draft's edit label all read the page title.

The climb now also stops at `main`, the page's column, as it did before
#5228. Content beside `main` still climbs to `body`. Behavior restored: an
unnamed element is named by its own words or a nearer holder, never by the
page's title.

Refs #5475
@leaf-agent
leaf-agent merged commit 447511d into main Nov 5, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-5475-label branch November 5, 2026 17:09
leaf-agent added a commit that referenced this pull request Nov 7, 2026
`test_design_mode_reads_each_shape_of_control_into_the_anchor_its_routes_carry`
has failed on main since #5506. Its "a control's name is its own"
subtest asserts that a field's design label carries no neighbouring
control's words. The `spoken` section had no heading, so the label's
`section:` context came from `main`'s leading `<h1>Settings</h1>`, the
climb #5506 deliberately stopped. Since then the unnamed section is
named by its own words, `Find settings ×`, and the close button's `×`
reaches the field's label through the section's name, not the field's.

The test this case came from
(`test_design_spoken_context_does_not_borrow_a_neighbours_face`, added
in b91b966) gave the section its own `<h2>`. #5409 dropped it when it
merged the case into `CONTROL_SHAPES`, and the subtest kept passing only
because of the #5228 bug that #5506 fixed. This restores a heading on
the section, so the assertion is again about the control's own label,
and #5506's naming stays as it is. No product behavior changes, and
`CONTROL_SHAPES` has no other reader.

**Verification.** The test fails on main `bdc4c03b0` with the issue's
message and passes with this change (35 subtests).

The issue's second test,
`test_render_gate.py::test_scrollbar_clearance_reads_generic_content_and_open_shadow_words`,
already passes on `bdc4c03b0` with no change here. That fits #5662,
which stopped the resting comment box from standing beside a target that
ends short of the column's edge, so the box's `aria-label` no longer
collides with the `First choice` role query.
`test_an_expanded_diff_file_can_retry_its_failed_chunk_in_place` stays
with #5641.

Closes #5645 — 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.

1 participant