Skip to content

Report a ring cover from a neighbour that left its holder's flow - #399

Merged
max-sixty merged 4 commits into
mainfrom
fix/ci-34111296814
Sep 7, 2026
Merged

max-sixty merged 4 commits into
mainfrom
fix/ci-34111296814

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

ring_faults's cover half excuses a neighbour the control paints over by ranking the box that holds it: a box present at the stepped-in point and ranking below the control puts what it holds below the control too. That guard is already on main — this branch's first commit went in with #389's squash (bc373f05:tests/render_cases_layout.py is byte-identical to 0ff3041b's), so what is left here is the second commit alone.

A holder's rank answers for what stays in its flow, and a positioned neighbour does not stay: it leaves its holder's place in the flow to paint in the positioned layer of the nearest ancestor stacking context. So a static holder ranking behind the control says nothing about the box it holds, and a position: fixed band inside one — topmost in the hit stack where the ring is sampled — is dropped without a word. .lf-threads .lf-btn computes position: relative; z-index: auto, so that is a cover the gate loses on a control the page draws.

Solution

Where the ranked holder is static, ask the control's own layer instead of the holder's position. A control that names a z-index above the layer a lifted neighbour paints in stands in front of it whatever holds it — the panel's edge grip is position: absolute; z-index: 1, so no z-index: auto neighbour reaches its ring. A control that names none shares the layer, and a neighbour lifted into it can stand over the ring, so the reading reports it. Where nothing was lifted, or the ranked holder is positioned too, the walk answers exactly as before.

test_the_ring_reading_sees_a_neighbour_lifted_out_of_the_flow_it_was_ranked_in is the plant: a fixed band over the ring's top run of a thread card's button, held by a static box beside it. The grip's own plant gains the other side — the same band under a static holder reads as nothing, because the grip's z-index: 1 stands over the layer it was lifted into.

Testing

  • test_the_ring_reading_sees_a_neighbour_lifted_out_of_the_flow_it_was_ranked_in — red on main's walk (a band standing over the ring read as []), green with this change.
  • The grip's third half — red if the condition reads the holder's position alone (+ ['its left edge is under div "" ...']), green with the control's layer in it.
  • uv run pytest tests/test_render_controls.py tests/test_render_conversations.py --run-nightly (159 passed): the two modules that read rings_drawn / ring_faults.
  • uv run pytest tests — 901 passed, 6 skipped. uv run pre-commit run --files on the three files.
The paint orders this is written against

elementsFromPoint at a point inside both the band and the control, front to back, with the band planted in each configuration the tests use:

grip (position: absolute; z-index: 1)
  band fixed, no z-index, in an absolute holder   ['lf-ui lf-edge', 'probe-band', 'lf-under-plant', ...]   grip in front
  band fixed, z-index: 2, in an absolute holder   ['probe-band', 'lf-ui lf-edge', 'lf-under-plant', ...]   band in front
  band fixed, no z-index, in a static box         ['lf-ui lf-edge', 'probe-band', '', 'lf-under-plant']    grip in front

.lf-threads .lf-btn (position: relative; z-index: auto)
  band fixed, no z-index, in an absolute holder   ['probe-band', 'lf-under-plant', 'lf-btn ...', ...]      band in front
  band fixed, no z-index, in a static box         ['probe-band', '', 'lf-under-plant', 'lf-btn ...']       band in front

wrap changes which box the walk ranks; it does not change what the browser paints. The grip's z-index is what keeps every z-index: auto neighbour off its ring.


Automated fix for failed run

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The diagnosis holds up and I reproduced both halves of the claim locally: test_coarse_pointer_resize_reach_stays_reachable_without_trapping_scroll fails on this tree with the guard neutralised (its bottom edge is under div.lf-receipt.lf-ui "✓ Sentjust now", sampled 25,467) and passes with it, and the new plant goes red on the first half with the guard reverted and on the second half with the guard forced always-on. tests/test_render_controls.py and tests/test_render_conversations.py are 158 passed under --run-nightly here.

One finding, inline: the walk's escape hatch reads z-index but not position, so a positioned neighbour with z-index: auto under a static holder gets excused, and a cover the reading used to report is now dropped.

Reproduction, and a direction that keeps the motivating case

Focus .lf-threads .lf-btn on release-notes (the sibling test's own setup — that control computes position: relative; z-index: auto), then plant a band that genuinely paints in front of it, held by a static box that ranks behind it:

const el = document.activeElement;
const b = el.getBoundingClientRect();
const w = document.createElement('div');
w.className = 'probe-w';
w.style.cssText = 'margin-top: -100vh; height: 100vh;';   // static: in-flow layer, behind a relative control
const band = document.createElement('div');
band.className = 'probe-band';
band.style.cssText = `position: fixed; background: red;
  left: ${b.left - 8}px; top: ${b.top - 5}px;
  width: ${b.width + 16}px; height: 4px;`;
w.append(band);
el.closest('.lf-panel').append(w);

probe-band comes back topmost in the hit stack at the sampled point, ahead of the control. On b8d451cb the reading says so; with this change it says nothing:

before: ['its top edge is under div.probe-band "" (ring 1145,191,1181,227 vs 1141,190,1185,194, sampled 1163,192)']
after:  []

The walk stops at probe-w, which is present at the stepped-in point and ranks behind the control, and concludes the band it holds is behind the control too. It is not: probe-band is positioned, so it leaves probe-w's in-flow position and paints in the positioned layer of the nearest ancestor stacking context, in front of every in-flow box there.

What closes it is one more condition on the same walk — a box that hoisted out of its holder can only be ranked against a holder that is itself in the positioned layer:

        let hoisted = false;
        for (let a = over; a && control >= 0; a = above(a)) {
          if (holds(a, el)) break;
          const acs = getComputedStyle(a);
          const ranked = inside.indexOf(a);
          if (ranked >= 0) {
            if (hoisted && acs.position === 'static') break;
            under = ranked > control;
            break;
          }
          if (acs.zIndex !== 'auto') break;
          if (acs.position !== 'static') hoisted = true;
        }

The receipt is static and .lf-threads is position: relative, so the grip's case is unchanged; the new plant's own band is position: fixed under an absolute holder, so it is unchanged too. Measured here: the five ring tests pass, the probe above is reported again, and test_render_controls.py plus test_render_conversations.py are green under --run-nightly. Worth a plant of its own either way — the second half of the new test only exercises the z-index escape, so nothing currently holds the position one.

Comment thread tests/render_cases_layout.py Resolved
max-sixty added a commit that referenced this pull request Sep 7, 2026
Leaf had two competing shapes for ordinary controls: the shared
rectangular Button face and page-local capsules. Compact status and
metadata labels used the same capsule geometry, so shape did not
reliably distinguish actions from state.

This change gives every ordinary action the shared 6px Button corner,
whether it uses text or only an icon. Send, Resolve, Close, reaction
overflow, attachment removal, and the floating response field now belong
to that rectangular family. Compact state, value, and reaction labels
use filled 3px chips. Circles remain only where the geometry has its own
meaning: the document-margin Button family and circular status or
selection markers. The change also removes the `lf-pill` vocabulary
throughout the runtime, packages, examples, tests, and generated MCP
App.

Keyboard focus reveals a margin Button's label immediately, avoiding a
paint-only tooltip transition that could be restarted while the living
margin settled. The interaction gallery keeps contained preview frames
out of the rendered page until they are ready, so initialization cannot
interrupt outer-page focus while the fixed stage preserves layout. The
deeper runtime repaint repair in
[#394](#394) and the
contained-frame focus/export boundary in
[#383](#383) have both landed and
are merged into this branch. This PR owns the reader-facing
presentation.

The landing-page stills and GIF were re-recorded from the shipped
runtime, and their content-addressed product-page references now point
to those images.

The branch also carries the paint-order correction from
[#399](#399), so the nightly ring
check distinguishes content underneath an outlined control from content
covering that control.

Local checks passed: pre-commit; 907 everyday tests; focused
controls/margin, interaction-gallery, option/chip, conversation, and
site modules; an eight-case pass covering the changed embedded action
faces; the selected-reaction nightly; both coarse-pointer paint-order
cases; the seven product-page tests; and the complete 35-page site
build.

> _This was written by Codex on behalf of max-sixty_

---------

Co-authored-by: leaf-agent <[email protected]>
The walk that excuses a neighbour the control paints over stopped at a
z-index named on the way up, because a z-index is one of the things that
lifts a box past the holder being ranked. Position is the other: a
positioned box leaves its holder's place in the flow and paints in the
positioned layer of the nearest ancestor stacking context, so a static
holder ranking below the control says nothing about it, and a fixed band
inside one — topmost in the hit stack at the sampled point — was dropped
without a word. A positioned holder still answers, since a box it holds
paints after it in that same layer.

The plant gets its third order: the same band under a static box that
ranks behind the grip. It goes red on that half with the condition
removed.
# Conflicts:
#	tests/CLAUDE.md
#	tests/render_cases_layout.py
#	tests/test_render_controls.py

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The third plant asserts a cover the page does not paint, and the position condition it pins reports one. A positioned box with z-index: auto paints in the z-index: auto / 0 layer of its nearest ancestor stacking context — level with a positioned holder that names no z-index, and below anything that names a positive one. The grip names one: .lf-edge { position: absolute; ... z-index: 1 } in runtime/chrome.css. So no z-index: auto neighbour can stand over the grip's ring whatever holds it, and {z: 0, wrap: True} is the same paint order as {z: 0, wrap: False} — which the plant above it asserts reports nothing. tests/CLAUDE.md carries the same claim ("a positioned box under a static holder, which leaves the flow that holder's rank answers for") and wants the same correction.

The thread's own case is untouched by this: .lf-threads .lf-btn computes position: relative; z-index: auto, so a hoisted neighbour genuinely does stand over it and the reading has to say so. The condition is worth keeping — it needs the control's own layer in it rather than the holder's position alone, and a plant against a control that names no z-index.

Everything else here holds up. test_coarse_pointer_resize_reach_stays_reachable_without_trapping_scroll and the ten ring readings beside it are green on 24dc3299 (11 passed), and the z: 2 half is a correct reading of a real cover.

Measured on the plant's own page

Same three stacking configurations as the plant, with the band laid on the grip's box instead of beside it so the two can be ranked directly. elementsFromPoint at a point inside both, front to back:

{z: 0, wrap: False}  ['lf-ui lf-edge', 'DIV', 'lf-under-plant', 'lf-panel-head']   grip in front
{z: 2, wrap: False}  ['DIV', 'lf-ui lf-edge', 'lf-under-plant', 'lf-panel-head']   band in front
{z: 0, wrap: True}   ['lf-ui lf-edge', 'DIV', 'DIV', 'lf-under-plant']             grip in front

The grip computes position: absolute; z-index: 1 in all three. wrap changes which box the walk ranks; it does not change what the browser paints.

And the same shape reduced to a standalone page, with the control's own z-index the only variable — a position: fixed; z-index: auto band inside a static box inside an absolute holder, all in one stacking context:

control z-index: auto  band > under > plant > ctl    band in front
control z-index: 1     ctl > band > under > plant    control in front

Comment thread tests/render_cases_layout.py Resolved
Comment thread tests/test_render_controls.py Resolved

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing pushed since the last review is the base merge, and it changed what this PR contains. #389 squashed to bc373f05 carrying this branch's first commit with it: bc373f05:tests/render_cases_layout.py and bc373f05:tests/CLAUDE.md are byte-identical to 0ff3041b's, and test_the_ring_reading_passes_over_a_neighbour_the_control_paints_across is already defined on main. So the guard the description is written around — the one that stops the coarse grip's ring reading a thread line as a cover — is on main, and after the merge gh pr diff 399 is the second commit alone: the position condition and the third plant half.

That leaves the PR carrying only the part the two open threads are about, with the Problem, Solution and Testing sections describing work that landed elsewhere. Worth deciding between closing it and reworking the condition around the control's own stacking level rather than the holder's position alone — and updating the description either way, since as written it credits this PR with a repair main already has.

The walk that excuses a neighbour the control paints over ranks the box
holding it, which answers for what stays in that box's flow. A positioned
neighbour does not stay: it paints in the positioned layer of the nearest
ancestor stacking context, so a static holder ranking behind the control
says nothing about it, and a fixed band inside one — topmost in the hit
stack at the sampled point — was dropped without a word.

The layer is the control's own to answer, not the holder's position: a
control naming a z-index above that layer stands in front whatever holds
the neighbour, which is what the grip's `z-index: 1` does, and one that
names none shares the layer and can be covered. `.lf-threads .lf-btn`
computes `position: relative; z-index: auto` and is the plant for it;
the grip's third half holds the other side, where a lifted neighbour must
still read as nothing.
@leaf-agent leaf-agent changed the title Stop the focus-ring reading calling a neighbour beneath the control a cover Report a ring cover a control's own layer does not stand over Sep 7, 2026
@leaf-agent leaf-agent changed the title Report a ring cover a control's own layer does not stand over Report a ring cover from a neighbour that left its holder's flow Sep 7, 2026
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Reworked rather than closed, and the description and title now describe what gh pr diff 399 contains: the first commit is on main with #389's squash, and this PR is the layer condition and its two plants.

The condition itself changed with it — the holder's position alone reported a cover the page does not paint, so it asks the control's own layer where the ranked holder is static. The grip's z-index: 1 keeps every z-index: auto neighbour off its ring whatever holds it; a control that names none shares that layer, and there a neighbour lifted out of its holder's flow was being dropped. Both sides are planted, and each goes red on the other's terms. Pushed as 391600dd; the two modules that read ring_faults are 159 passed under --run-nightly, and uv run pytest tests is 901 passed / 6 skipped.

@max-sixty
max-sixty merged commit aa7c97f into main Sep 7, 2026
10 checks passed
@max-sixty
max-sixty deleted the fix/ci-34111296814 branch September 7, 2026 13:55
max-sixty added a commit that referenced this pull request Sep 7, 2026
Leaf had two competing shapes for ordinary controls: the shared
rectangular Button face and page-local capsules. Compact status and
metadata labels used the same capsule geometry, so shape did not
reliably distinguish actions from state.

This change gives every ordinary action the shared 6px Button corner,
whether it uses text or only an icon. Send, Resolve, Close, reaction
overflow, attachment removal, and the floating response field now belong
to that rectangular family. Compact state, value, and reaction labels
use filled 3px chips. Circles remain only where the geometry has its own
meaning: the document-margin Button family and circular status or
selection markers. The change also removes the `lf-pill` vocabulary
throughout the runtime, packages, examples, tests, and generated MCP
App.

Keyboard focus reveals a margin Button's label immediately, avoiding a
paint-only tooltip transition that could be restarted while the living
margin settled. The interaction gallery keeps contained preview frames
out of the rendered page until they are ready, so initialization cannot
interrupt outer-page focus while the fixed stage preserves layout. The
deeper runtime repaint repair in
[#394](#394) and the
contained-frame focus/export boundary in
[#383](#383) have both landed and
are merged into this branch. This PR owns the reader-facing
presentation.

The landing-page stills and GIF were re-recorded from the shipped
runtime, and their content-addressed product-page references now point
to those images.

The branch also carries the paint-order correction from
[#399](#399), so the nightly ring
check distinguishes content underneath an outlined control from content
covering that control.

Local checks passed: pre-commit; 907 everyday tests; focused
controls/margin, interaction-gallery, option/chip, conversation, and
site modules; an eight-case pass covering the changed embedded action
faces; the selected-reaction nightly; both coarse-pointer paint-order
cases; the seven product-page tests; and the complete 35-page site
build.

> _This was written by Codex on behalf of max-sixty_

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 7, 2026
## Problem

`ring_faults`'s cover half excuses a neighbour the control paints over
by ranking the box that holds it: a box present at the stepped-in point
and ranking below the control puts what it holds below the control too.
That guard is already on `main` — this branch's first commit went in
with #389's squash (`bc373f05:tests/render_cases_layout.py` is
byte-identical to `0ff3041b`'s), so what is left here is the second
commit alone.

A holder's rank answers for what stays in its flow, and a positioned
neighbour does not stay: it leaves its holder's place in the flow to
paint in the positioned layer of the nearest ancestor stacking context.
So a static holder ranking behind the control says nothing about the box
it holds, and a `position: fixed` band inside one — topmost in the hit
stack where the ring is sampled — is dropped without a word.
`.lf-threads .lf-btn` computes `position: relative; z-index: auto`, so
that is a cover the gate loses on a control the page draws.

## Solution

Where the ranked holder is static, ask the control's own layer instead
of the holder's position. A control that names a z-index above the layer
a lifted neighbour paints in stands in front of it whatever holds it —
the panel's edge grip is `position: absolute; z-index: 1`, so no
`z-index: auto` neighbour reaches its ring. A control that names none
shares the layer, and a neighbour lifted into it can stand over the
ring, so the reading reports it. Where nothing was lifted, or the ranked
holder is positioned too, the walk answers exactly as before.


`test_the_ring_reading_sees_a_neighbour_lifted_out_of_the_flow_it_was_ranked_in`
is the plant: a fixed band over the ring's top run of a thread card's
button, held by a static box beside it. The grip's own plant gains the
other side — the same band under a static holder reads as nothing,
because the grip's `z-index: 1` stands over the layer it was lifted
into.

## Testing

-
`test_the_ring_reading_sees_a_neighbour_lifted_out_of_the_flow_it_was_ranked_in`
— red on `main`'s walk (`a band standing over the ring read as []`),
green with this change.
- The grip's third half — red if the condition reads the holder's
`position` alone (`+ ['its left edge is under div "" ...']`), green with
the control's layer in it.
- `uv run pytest tests/test_render_controls.py
tests/test_render_conversations.py --run-nightly` (159 passed): the two
modules that read `rings_drawn` / `ring_faults`.
- `uv run pytest tests` — 901 passed, 6 skipped. `uv run pre-commit run
--files` on the three files.

<details><summary>The paint orders this is written against</summary>

`elementsFromPoint` at a point inside both the band and the control,
front to back, with the band planted in each configuration the tests
use:

```
grip (position: absolute; z-index: 1)
  band fixed, no z-index, in an absolute holder   ['lf-ui lf-edge', 'probe-band', 'lf-under-plant', ...]   grip in front
  band fixed, z-index: 2, in an absolute holder   ['probe-band', 'lf-ui lf-edge', 'lf-under-plant', ...]   band in front
  band fixed, no z-index, in a static box         ['lf-ui lf-edge', 'probe-band', '', 'lf-under-plant']    grip in front

.lf-threads .lf-btn (position: relative; z-index: auto)
  band fixed, no z-index, in an absolute holder   ['probe-band', 'lf-under-plant', 'lf-btn ...', ...]      band in front
  band fixed, no z-index, in a static box         ['probe-band', '', 'lf-under-plant', 'lf-btn ...']       band in front
```

`wrap` changes which box the walk ranks; it does not change what the
browser paints. The grip's z-index is what keeps every `z-index: auto`
neighbour off its ring.

</details>

---
Automated fix for [failed
run](https://github.com/max-sixty/leaf/actions/runs/34111296814)

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Sep 7, 2026
Two conflicts, both import lists, and one thing worth recording.

`composing/selection.js`: main's #395 added `keeps`; this branch had extended
the module's docstring for the kept-draft address. Both.

`keyboard/page.js`: main's #388 added five response-option imports and kept
`pendingDrawing`; this branch had replaced `pendingDrawing` with `composerHolds`,
the single reading of whether the box holds anything a reader would miss. The
union, less `pendingDrawing`, which no longer has a use in the file.

Main's #399 ("Report a ring cover from a neighbour that left its holder's flow")
lands in the same ring reading this branch changed, and the two compose rather
than duplicate: theirs answers a neighbour out of its holder's flow, this one
answers a control painting in front of the box reported over its ring. Both
excuse only what they demonstrate.

Co-Authored-By: Claude Opus 5 (1M context) <[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