Repository navigation
Set a reading role's ARIA role, name and pane region from its declaration - #7482
Merged
Merged
Conversation
…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.
leaf-agent
approved these changes
Nov 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A widget that draws nothing now needs no module: Leaf sets what its declaration states.
lf-groupandlf-paneonly 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.reading-rolemark gainsrole(pane→region,group→group). Both existing painters,mark_declaredfor served pages and revisions andmarkDeclaredfor thread messages, write thatroleand anaria-labelfromlabel, each unless the author wrote it.watchPanes(declared-words.ts) marks a pane's body as its reading region as the pane arrives, withwatchArrivals. 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.verbatimleaves 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-labelwins overlabel. 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 --baseadds none).Code +50/−62 (−54 is the two modules), tests +112/−15, docs +11/−10, excluding compiled mirrors.
pnpm run checkpasses; the pane, group, revision and ring browser tests pass by node id;leaf-dev stills --baseshows 7 of 7 pane and group states unchanged.