Skip to content

Remove the disclosure watch: nothing reads what it repainted - #6976

Merged
max-sixty merged 7 commits into
mainfrom
agent-aec02795986ff2a7d
Nov 24, 2026
Merged

max-sixty merged 7 commits into
mainfrom
agent-aec02795986ff2a7d

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

A follow-up to #6953, which took out the last widget rows whose aria-keyshortcuts this watch kept current. It was a MutationObserver over the document and every shadow stage: on each open or aria-expanded change it marked the command scopes around the element and asked for the repaint frame. The dispatcher reads the page's own disclosure row as it is asked, so nothing reads what the watch repainted, and every page paid for it.

Nothing a user can see changes. With the watch gone, 1,279 Chromium browser tests of disclosures and of the chrome whose controls write aria-expanded pass by node id. Six fail the same way with the watch standing, so main has them already: test_sample_browser_boundary_contains_focus_scroll_and_parent_access, test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline, test_a_data_bound_diff_aims_and_selects_one_source_line, test_each_sampled_focus_ring_is_shown_whole_in_its_surface, test_a_summary_folds_its_messages_where_they_stand and test_file_tree_lands_at_the_file_start_after_reading_down. leaf-dev probe --base in Chromium and Firefox ends every step of five journeys with the same DOM on both arms, but for values that vary from run to run on either. A margin test's news reading existed for the watch and goes with it.

Ran pnpm run check, pre-commit, and a fresh-context review, which found nothing that depends on the watch.

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

Two functions a widget imported to ask for what Leaf's keyboard already does
for every element. The package API exports 175 names, from 177.

DISCLOSE. lf-diff's file row and a settled lf-options' row each declared a
run-less command row whose keys came from DISCLOSE. The row re-worded a press
the page's disclosure scope (keyboard/page.js, disclosure.toggle) already
answers on every `details > summary` and every button with `aria-expanded`, a
widget's and a staged one included. Both rows go. control-keys.js existed to
hand DISCLOSE to portable-api.js without the dispatcher, so it folds into
keyboard/disclosure.js.

allButCommandReference. lf-file-editor's conflict menu gave it as its scope's
`claims`. The dispatcher already keeps letters and digits from every scope
around an ARIA menu that holds focus (text-entry.js, TYPES_AHEAD) and keeps
Escape inside an open popover, so the menu declares no claim. The function
stays the runtime's own, for Go-to, reactions, region capture and the target
picker. No package declares `claims` now, so module-input.md stops describing
the option and says what Leaf holds for a menu, a popover and a modal dialog
with nothing declared.

What a user can see change, measured with `leaf-dev probe --base` in Chromium
and Firefox:

- While the user was on a diff's file row, the command reference listed its
  press twice, as "On a disclosure: close" and "On a diff: hide this file",
  and a settled row's twice, the second under "In settled options". It lists
  each once now, in the page's words.
- Those two rows no longer carry `aria-keyshortcuts`, which named Enter, Space
  and the arrow. No other disclosure on a page carries it. Their keys work as
  before.
- In the conflict menu the page's keys that are neither letters nor digits act
  again: `/` opens page search over the open menu, where it did nothing. `c`
  and `t` still wait.

Tests. test_the_arrows_say_which_way_the_section_under_the_user_goes and
test_staged_widget_controls_name_the_presses_their_owners_make read the arrow
the dispatcher offers in place of the rows' `aria-keyshortcuts`. They still
hold that only the arrow that changes the disclosure is offered, for both
spellings and for a staged summary, and that it turns over with each press.
Their comments credited the disclosure watch with that turn; the dispatcher
reads DISCLOSE as it is asked, so they say that instead. The Node test of a
template scope's function rows reads the element directly rather than through
DISCLOSE.
A MutationObserver over the document and every shadow stage watched `open` and
`aria-expanded`. On each change it marked the command scopes on, in and around
the element to be read again and asked for the repaint frame. It kept current
the `aria-keyshortcuts` of widget rows whose keys came from DISCLOSE; #6953
removed the last of those rows, and the dispatcher reads the page's own
disclosure row as it is asked. Every page paid for the observer.

Whether anything else relied on the frame it asked for, checked with the watch
standing beside this tree:

- Chromium browser tests by node id, with the watch gone: the 485 whose source
  touches a disclosure or `aria-expanded` (478 pass, 3 expected failures, 4
  fail), and 802 more of the margin, thread, panel, reaction, key-scope,
  command-route and preview surfaces, whose controls write `aria-expanded` (all
  pass). The 4 fail the same way with the watch standing:
  test_sample_browser_boundary_contains_focus_scroll_and_parent_access,
  test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline,
  test_a_data_bound_diff_aims_and_selects_one_source_line and
  test_each_sampled_focus_ring_is_shown_whole_in_its_surface.
- `leaf-dev probe --base` in Chromium and Firefox, dumping the composed DOM
  after each step of five journeys: an lf-diff file row and its expand-all, a
  settled lf-options row, the panel's leaf, Threads and a thread opened from
  it, a walk between threads with their margin entries and cards, and an
  lf-diff in a thread's message. Each step ends with the same DOM on both arms,
  but for two things that vary from run to run on either arm: the fallback a
  thread card's anchored edge names, which no engine here uses, and the order of
  that card's inline declarations. The card's box is the same.
- A fresh-context review ran about 450 further steps across Chromium, Firefox
  and WebKit and found the arms identical. With the watch, a toggle of a settled
  row cost about 2.5 times the geometry reads for the same end state.

Removed with it: the `news` reading in `_refreshes_restate_no_margin_name`,
which failed a refresh that moved a watched attribute because the watch would
repaint the page's keys, and the watch's mentions in lib/keeps.js and
shadow-stage.js. The scopes.js comment on `commandsOn` no longer cites a
disclosure's toggle, which no template declares.
@max-sixty
max-sixty merged commit ee4f5fd into main Nov 24, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-aec02795986ff2a7d branch November 24, 2026 07:22
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