Skip to content

Set a reading role's ARIA role, name and pane region from its declaration - #7482

Merged
max-sixty merged 1 commit into
mainfrom
review-effect-ui
Nov 28, 2026
Merged

max-sixty merged 1 commit into
mainfrom
review-effect-ui

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A widget that draws nothing now needs no module: Leaf sets what its declaration states. lf-group and lf-pane only gave themselves a role, an accessible name and (the pane) its body's scroll marks, so their modules are deleted. Max picked this on the Effect UI review page ("Have Leaf set what the declaration states"), and #7478's "Renderers" now says a widget that draws nothing has no module.

  • The kernel registry's reading-role mark gains role (pane → region, group → group). Both existing painters, mark_declared for served pages and revisions and markDeclared for thread messages, write that role and an aria-label from label, each unless the author wrote it.
  • watchPanes (declared-words.ts) marks a pane's body as its reading region as the pane arrives, with watchArrivals. That re-runs when the pane's children change, so a body a revision brings in takes the region. These marks are runtime paint, which a revision's source strips, so the server can't deliver them.
  • verbatim leaves both declarations, since composition refuses it without a module. The version comparison counts an element in a reading role as a block in its place, which is the same two tags.

What a user sees differently: a revision that renames a pane's or group's label now edits it in place instead of replacing it, so scroll and focus stay. An author's own aria-label wins over label. A package's own module-less pane tag gets its reading region too.

To weigh: the reading-role → ARIA role table is a kernel fact in $marks, not a package-interface name (leaf-dev interface --base adds none).

Code +50/−62 (−54 is the two modules), tests +112/−15, docs +11/−10, excluding compiled mirrors. pnpm run check passes; the pane, group, revision and ring browser tests pass by node id; leaf-dev stills --base shows 7 of 7 pane and group states unchanged.

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

…tion

A widget that draws nothing has no module: Leaf sets on its element what
its declaration states. `lf-group` and `lf-pane` only labelled their own
element, so both modules go.

- `$marks.reading-role` maps each reading role to an ARIA role (`pane` to
  `region`, `group` to `group`). Delivery (`mark_declared`) and a message's
  paint (`markDeclared`) write it as `role`, with the element's `label` as
  `aria-label`, each unless the element writes it itself. Both now stand in
  the served document, from the first paint, and a revision that renames a
  label brings its `aria-label` along.
- `watchPanes` (records/declared-words.js) marks the body of each element
  whose tag declares `reading-role: pane` as the pane's reading region, as
  the pane arrives and when its children change, as lf-pane.js did. Those
  marks are runtime paint, which a revision's source snapshot strips
  (`authoredMarkup`), so delivery can't carry them; and readers that found
  a pane's body from `[data-lf-reading-role="pane"]` would also take the
  boxes a playground generates in that role, which mark their own regions
  under their own names. A package's own pane tag now gets its region too.
- `lf-group` and `lf-pane` drop `verbatim`, which needs a module. The
  version comparison counted them as blocks through it; it now counts an
  element in any reading role as one, so a pane's bare header and footer
  still compare.

Behaviour a test now holds differently: a revision that changes a pane's
label replaced the pane whole, since its module declared `lfPatch`; with no
module the patch edits the pane in place and its body keeps its scroll.
test_a_revision_that_replaces_a_panes_body_returns_the_reader_to_their_place_in_it
now replaces the body by rewriting it as another element, and checks that
the pane stays and its `aria-label` follows the new label.
@max-sixty
max-sixty merged commit 576526d into main Nov 28, 2026
7 checks passed
@max-sixty
max-sixty deleted the review-effect-ui branch November 28, 2026 03:26
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