Skip to content

Make phone text and element commenting reachable - #923

Merged
max-sixty merged 5 commits into
mainfrom
codex/phone-commenting
Sep 22, 2026
Merged

max-sixty merged 5 commits into
mainfrom
codex/phone-commenting

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Phone readers can now select a whole element through More → Select element, or highlight words and tap Comment on selection in the banner. The comment field opens only after that explicit handoff, so it no longer competes with the native selection menu. The added element-selection controls are limited to touch devices; desktop selection and keyboard targeting retain their existing behavior.

Live pages and interactive exports share a default mobile viewport, including viewport-fit=cover for safe-area layout, when the author omitted one. Duplicate declarations in page sources are removed. Floating comments respect the visual viewport, and diff wrapping has a larger touch target with reliable WebKit updates. The public guidance, feature gallery, and browser coverage exercise these paths.

Validation: the everyday suite, 119 chrome/aim/selection browser checks after integrating main, 40 selection tests after the desktop pointer repair, 3 interactive-export checks, 33 runtime tests, focused diff checks, and pre-commit. WebKit phone emulation and Chrome desktop checks cover the selection-to-comment flow; native iPhone menu/keyboard verification and the remaining phone reading work stay tracked in TODO.md.

This was written by Codex on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

TODO.md narrows the phone item to "verify on a real iPhone", but three things the old item named are not in this diff: visible passage threads, hover-only reasons, and clipped diagram content — skills/leaf/packages/diagram/ is untouched and nothing here changes thread or margin rendering. Retiring them from the priority list is the part that costs later: the next reader sees a phone journey whose only open work is device verification. Keeping them as their own item (suggestion below) makes the narrowing say what it did.

pointerChoosing() is chooserOpen && !pageSearchOpen with no pointer gate, so aim's new capture claims desktop mouse presses too. Same page on both heads — press s, then click a paragraph link: on the merge base (4486b342) the click follows the link and the URL gains #elsewhere; on this head the link is not followed and the comment field opens on the paragraph instead. Unifying the two is defensible — a modal mode claiming the whole press is the argument aim.js already makes for Design mode — but it isn't what the description says ("desktop selection and keyboard targeting retain their existing behavior"), no test pins it, and on desktop a press that resolves no target is swallowed with no Cancel control to leave by. Either gate pointerChoosing() on coarsePointer.matches, or keep the unification and give it a case and a line in the description.

Delivery now supplies <meta name="viewport">, and the public contract still reads the other way: skills/leaf/references/page-authoring.md tells authors "Leaf adds the encoding, CSP, identity, theme, runtime, and canonical address when it delivers the document" and hands them the viewport meta in the skeleton, and docs/how-it-works.html still names s plus a hint and Alt-click as the routes into a Comment field, with no touch route. Both are readers this change is aimed at. I can push those two edits to the branch if you'd rather they land here than separately.

Comment thread TODO.md Resolved

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Delivery's default viewport omits viewport-fit=cover, and the theme is built around having it. theme.css reads the four insets into --lf-safe-* and folds the top one into the banner's own height — --lf-banner-h: calc(42px + var(--lf-safe-top)) — while chrome.css spends them across the banner's padding, the shortcut bar, the bottom status line, the FAB column and the page-map sheet's padding-bottom: max(14px, env(safe-area-inset-bottom)). iOS Safari only reports a non-zero env(safe-area-inset-*) when the viewport opts in with viewport-fit=cover, so on a notched iPhone every one of those allowances collapses to 0px and the strip the banner reserves for the status bar reserves nothing. The pages that lose it are exactly the ones written to the skeleton this commit trimmed, on the device the PR is about.

The one-line content isn't really the finding — the divergence is. Leaf's chrome wants an edge-to-edge viewport, that rule is stated nowhere, and 38 page heads across examples/, docs/, tests/fixtures/, scripts/corpus.py and scripts/record-demo.py restate it one at a time. Putting viewport-fit=cover in the delivered default settles it where the chrome that needs it lives and makes those 38 metas redundant; the reference sentence and the parametrized default in test_chrome_contracts.py move with it. Keeping the conservative default is a defensible answer too, but then the skeleton keeps its own viewport meta and the reference says what the author is choosing between — as written, "include one only to choose a different policy" reads as though the default were the neutral one.

Comment thread skills/leaf/scripts/leaf/http.py Resolved
@max-sixty
max-sixty merged commit c6c9cb3 into main Sep 22, 2026
5 checks passed
@max-sixty
max-sixty deleted the codex/phone-commenting branch September 22, 2026 10:03
max-sixty pushed a commit that referenced this pull request Sep 22, 2026
…s, banner shelf, and gallery layout (#930)

`ci` on `main` is red: the [scheduled complete suite on
4ffc2bd](https://github.com/max-sixty/leaf/actions/runs/35718248873)
reported nineteen failures. Fourteen of those node ids, across twelve
nightly browser cases, read chrome shapes that three of the morning's
merges moved, and this updates those readings. A fifteenth case, which
that run did not reach, broke on the merge after it. The remaining five
are #917's, already open against #905's native `<details>`; nothing here
touches them, so `main` needs both to come back green. No runtime code
changes.

## What moved, and what each test reads now

**#921 (4ffc2bd) gave the thread panel two selection levels.** Escape
from a selected thread now returns to whole-panel selection, and the
press after that closes the panel. Nine node ids across four files
walked out of Threads in two presses and asserted the panel gone on the
second. Each now states the level it gained — `.lf-threads` holds the
selection — before the press that closes the panel, which is the shape
#921 gave the tests it could see in `test_render_navigation.py`. The
intermediate `expect` is also the arrangement: it settles the release
before the next Escape rather than firing two presses into one turn.

**#918 (a45144d) made the thread lifecycle filters a `wa-radio`
group.** Three tests read the standing choice off `aria-pressed`, which
a radio does not wear; they now use `to_be_checked()`, the reading the
everyday-gate tests #918 updated already use. The same change also made
the group exclusive, so re-pressing the standing member no longer widens
the list —
`test_an_ok_on_the_agents_latest_reply_takes_the_thread_out_of_waiting`
pressed "On you" a second time to get every thread back and now chooses
the group's open member instead. That second fault was behind the first:
the test stops at the `aria-pressed` read, so the run never reached it.

**#923 (c6c9cb3) added touch-only selection controls to the banner shelf
and renamed the `s` command.** `commentSelection` and `cancelSelection`
rank after `threads`, and `select-element` is `alwaysFolded`, so two
tests counting the shelf's markup — the last child of
`.lf-banner-actions`, the number of children in `.lf-banner-menu` — were
reading inventory where they meant what the reader meets. Both now read
what stands: the last *visible* control in the row, and, for the door,
what is behind it once it is opened. A third read the reference's
wording for `target.chooser.open`, a string
`test_render_semantic_selection.py` also reads; this reads the reference
row by its command id instead, so the words are stated in one place
rather than two. Both cases are nightly, so nothing holds that string
before `main` either way — #923 updated the one and not the other, which
is the whole fault.

**#924 (ff34b91) grew the feature gallery between a case's scroll
target and its subject.**
`test_g_hints_reach_a_late_visible_action_only_location` scrolled to
`#bg-quoted-and-visual` and asked for the go-to chip belonging to
`#bg-shot`'s margin entry; the new `#bg-live-practice` section sits
between the two, so that scroll now leaves the entry about 1,200px below
the scrollport and the hint layer is right not to draw a chip for it.
The case reached that state because its guard was `to_be_visible`, which
says a control is laid out rather than that a reader can see it. It now
scrolls to the location's own anchor and reads `to_be_in_viewport`, so
the premise it states is the one the hint layer acts on. Checked alone
at both commits: green on 4ffc2bd, red on `ff34b919`.

## Why these are updates rather than a fix under them

Each failure is a nightly test hand-reading a shape the runtime or the
corpus owns, changed by a pull request whose own gate could not reach
it: `ci` runs the complete suite on `main` and on the schedule, never on
a pull request, because it holds a runner for over an hour on a shared
pool — a trade-off `ci.yaml` states, with `main`'s own run and
`tend-ci-fix` as the designed repair step. So the level above these
tests is working as intended, and the durable improvement available
inside them is to read a declaration instead of an incidental shape.
Every fault here but the Escape depth moves that way: a radio's
checked-ness and its exclusivity, a command id, and — twice — the run
that stands rather than the shelf's markup. The Escape-depth nine have
nothing more declarative to read — the press count *is* the behaviour —
and each states the unwind because the assertion around it is about
where focus lands and what stays open, so they keep their own narration.
The gallery case is the same move at the arrangement end: it now states
the premise the hint layer actually reads, so corpus content growing
under it fails loudly rather than quietly changing what the case is
about. That leaves the seam #917 named for the thread card exactly as
reachable as it found it: the panel's chrome has no single place a
change to it can find its readers.

## Verification

All fourteen failed in the scheduled run on 4ffc2bd, and each passes on
this branch under `uv run pytest --run-nightly -n0` on this CI host. The
fifteenth was found by running the six changed files whole:
`test_render_aim.py`, `test_render_anchors.py`,
`test_render_controls.py`, `test_render_margin.py`,
`test_render_navigation.py` and `test_render_reactions.py` are 574 cases
under `--run-nightly -n2`, and the only two failures were
`test_g_hints_reach_a_late_visible_action_only_location`, now fixed
here, and `test_a_thread_at_rest_shows_only_the_marks_that_stand_in_it`,
which is #917's. `pre-commit` passes on the changed files.

Besides the gallery case above, two cases have their arrangement changed
rather than only their assertions, so those three are the ones worth a
second look:
`test_the_responsive_action_row_keeps_primary_actions_in_reach` opens
the overflow door to read what stands behind it and closes it again,
because the shelf freezes its partition while the door is open and the
test registers another control straight after; and
`test_covering_threads_keeps_the_reader_and_their_work_inside` reads the
document's scroll position after the thread releases to the panel rather
than before, the release being the press that no longer closes the
sheet.

A pull request runs the everyday gate, which reaches none of these
files, so `ci` here says nothing about them; `main`'s own complete suite
on the merge is the first run that reads them.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Sep 23, 2026
…some fields at 16px (#979)

#950 moved every control except Approval and Threads behind More. Two of
those controls only exist during a reader's gesture: "Comment on
selection" after a touch selection, and "Cancel selection" while the
target chooser is open. On an iPhone, selecting words turned "Comment on
selection" on inside a closed popover that showed no marker, so the #923
flow described in the feature gallery ("tap Comment on selection in the
banner") took two taps on a door nothing pointed to. The tests missed it
because `banner_control` opens More without saying so.

## Banner shelf: a `gesture` seat

The shelf split controls between a fixed row and a fixed menu. It had
nowhere to put an action that a gesture produces and that lasts only as
long as the gesture. It now has three seats:

- `row`: Approval and Threads, the page's reading loop.
- `menu`: every secondary action, behind More.
- `gesture`: the next step of something the reader is doing right now.
While one is on offer it takes the reading loop's place on the row, and
the loop comes back when the gesture ends.

The swap is a fixed rule rather than a response to width, so the 320px
row (zero slack since #974) never has to hold both. If focus was on a
loop control when a step displaces it, focus moves to the step. "Comment
on selection" is now `primary`, so it reads as the thing to press. Both
gesture steps are coarse-pointer only, so nothing changes with a mouse.

## Web Awesome fields meet the 16px phone floor

On a coarse pointer, the layer's own fields compute 16px
(`--entry-floor`, `shadow.css`). The Threads find box and the Map search
are `wa-input`s, and their native field sits in a vendor shadow root
that rule cannot reach, so they computed 14px and iOS zoomed in on
focus. The theme bridge (`scripts/vendor-src/webawesome/leaf-theme.css`)
now sets the vendor's value size to `max(var(--entry-floor), 1em)`. That
covers `wa-input`, `wa-textarea`, and `wa-number-input`, including the
ones in the widget packages. The bundle is regenerated with
`scripts/vendor.py webawesome`. On desktop the floor is 0, so the value
resolves to `1em`, which matches what the unset token inherited before.

## Lit duplication: left as is

After boot, `window.litElementVersions` is `['4.2.2','4.2.2']`, because
`browser-runtime.js` and the Web Awesome bundle each bundle their own
Lit. Sharing one copy would mean pointing Web Awesome's imports (`lit`,
`lit/decorators.js`, and about eight directive subpaths) at a re-export
surface in `browser-runtime.js`. That would tie two independent builds
to one export list, which is more than a small build change.
`skills/leaf/assets/CLAUDE.md` now says the page runs two copies instead
of claiming Lit ships once.

## Tests

- The phone comment tests in `test_chrome_contracts.py` and
`test_render_aim.py`, and the touch Cancel test in
`test_render_semantic_selection.py`, read the step from
`.lf-banner-actions` with More shut. They no longer go through
`banner_control`. The iPhone test also checks that Threads gives way to
the step and that the step fits in the viewport.
- `test_a_phone_comment_field_keeps_its_passage_clear` now walks shadow
roots, so it reads the vendored fields as well, and it requires at least
one `wa-input`. Against the old bundle it fails with `14 >= 16`.
- Focused runs pass: phone and selection cases in
`test_chrome_contracts.py`, `test_render_semantic_selection.py`,
`test_render_aim.py`, and `test_render_controls.py` (26), plus the Web
Awesome, targeting, and playground widget cases (18). `npm run
test:runtime`: 55 passed.

> _This was written by Claude Code on behalf of max-sixty_

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Sep 27, 2026
…d card in the visible viewport (#1251)

How much of the window the page shows was measured at each site that
needed it. `key-badge-placement.js` (`chromeTop`),
`margin-projection.js` (`threadCardBoundary`), `composing/surface.js`
(`floatBoundary`, `BANNER_CLEAR = 48`), `reading-place.js` and
`design.js` each read the banner's box, and the thread card and the
composer each filtered the bottom chrome. The composer and the thread
card applied one rule written twice, and only the composer clamped to
the visual viewport (#923).

`geometry.js` now owns the reading. `banner.js` declares the banner
(`declareBanner`) and `keyboard/shortcut-bar.js` declares the bottom
band's boxes (`declareBottomBand`). `bannerFoot()` is where the room
starts, and `shownWindow({ within, gap })` is the visual viewport less
the banner and the bottom-band boxes across its width, narrowed to a
caller's box. The composer, thread card, key badges, target chooser,
hint map, design legend and reading place all read from these, and
`chromeTop`, `BANNER_CLEAR` and the `banner`/`bottomChromeBoxes` wiring
into the response surface and margin projection are gone.

Behaviour that moved:

- A thread card now stands inside the visual viewport, and re-places
when pinch zoom or a phone's software keyboard resizes or scrolls it.
Before this change a card low in the window kept its reply editor under
the shrunk viewport, at a desktop and a phone width alike
(`test_a_thread_card_reply_stays_in_the_visible_viewport`, which fails
on the base at both widths).
- The composer inside a reading region now also clears the banner and
the bottom band. Before, a region's shown box replaced those edges
rather than being intersected with them.
- The composer's gap below the banner is 8px, where it was 6px, and the
fixed 48px floor is gone.
- `bringForward` treats a target as hidden when its bottom is above the
banner's actual foot, rather than above 48px. On a phone the banner is
88px.
- The reading place (`blocksOnScreen`) reads the visual viewport and
stops at the bottom band, where it used to read to `innerHeight`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 6, 2026
While `s`'s hint map stands, the mouse now behaves as it does with Alt
held. The aim box paints on the element under the pointer as soon as the
picker opens, and a press chooses that element, closes the picker and
opens Comment without activating the link or control under it. Before
this, a desktop click while the hints stood went straight to the page,
so pointing at a link followed it. Touch already claimed presses there;
#923 gated that claim to touch only to keep desktop unchanged, not as a
product decision.

One predicate, `armedBy` in `aim.js`, now decides both what the box
promises and which presses are claimed, for Alt and the picker alike.
The only difference between them is the result: under the picker a press
chooses and closes it. Consequences:

- A press on a margin row, such as a suggestion's ✓ Accept, comments on
the change the row stands by instead of accepting it, as Alt already
did. The banner, Cancel selection included, still answers a press.
- A press over nothing is swallowed and the picker stays open.
- The second press of a double click joins the claimed first one rather
than reaching the page. Chromium counts clicks on `mousedown` but not on
`pointerdown`, so the continuation is recognised there.
- A middle press is claimed too (`auxclick`), so it no longer opens a
link in a new tab while the page is armed, under Alt or the picker.
- A direct `/` search, which arms no map, doesn't arm the page.
- On touch, presses are claimed as before, now also over margin rows and
seated threads inside the page, matching Alt. No hover box paints, since
a finger's last tap is not where it stands.
- The announcement and the command description say "press" rather than
"tap".

Tests: the desktop test that pinned plain link clicks passing through
the picker now asserts the opposite: the box paints on open, a middle
press opens no tab, and a double click opens Comment without navigating.
A new test holds the margin-row case.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.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