Skip to content

Make the draft editor an ordinary text box with Copy, and show Copy in the corner on touch - #2670

Merged
max-sixty merged 8 commits into
mainfrom
edit-box-buttons
Oct 12, 2026
Merged

max-sixty merged 8 commits into
mainfrom
edit-box-buttons

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

The lf-draft editor showed Save, Cancel and Close, and kept a second idea beside the text box: Escape set unsent words aside for the next opening, and a Changes list restored earlier saved versions. It now edits like an ordinary text box, with Save and Cancel, and gets a Copy control at its top right like code blocks. Copy on touch now follows the common pattern for both code blocks and drafts.

Draft editor

  • The footer offers Save and Cancel. Escape cancels too, as a message rewrite's Escape does. The field's own undo walks typing back, and the page's undo (z) withdraws a saved edit.
  • The Changes list, its Restore buttons and alignedNodes (only that list used it) are gone. The shared draft store holds only an open editor's words, so they survive a reload, a live revision that replaces the element, and a closed tab. Recovery reopens whatever the store holds: words that walked a saved edit back to the authored text used to be dropped on reload.
  • copyCodeBlock becomes copyBlock(block, source, noun), so the label names what it copies ("Copy Markdown" on a draft). At rest the control floats over the draft's corner as a code block's does; the open editor, which keeps it in view while typing, gives up its corner so the caret never runs under it.

Copy on touch

  • Give a finger Copy on the banner, not over a code block's first words #2626 hid the corner control from a finger and offered "Copy code" on the banner while the user stood on a block. Sites don't do that: the copy control sits at the block's top right, is hidden at rest, and appears on hover. On a phone it appears once the user taps the block.
  • A tap already stands the user on the block, so the corner control now shows on that tap and hides when the user leaves. It takes no room and covers nothing at rest. While hidden it takes no presses, so the words beneath it stay selectable, and the tap that reveals it doesn't also press it. Exports behave the same.
  • The banner mechanism is removed. touchPresses (keyboard/register.js) reads page scopes only again, and the "Touch routes" contract in keyboard/AGENTS.md drops its element-scope clause. A widget's control is now revealed by one rule, the widget's hover or focus within, which also gives lf-code the keyboard reveal it lacked.

Tests

  • Draft tests now leave the editor by stepping out to the page instead of pressing Escape, and drop the history assertions. A new test covers the walk-back reload.
  • The code-copy journey checks that a tap shows the corner control, that the control copies, and that leaving hides it and lets presses through.
  • tests/journeys/test_render_drafts.py::test_executable_revision_keeps_a_reader_who_scrolled_away_from_their_reply fails locally on main too.

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

max-sixty and others added 7 commits October 12, 2026 10:06
An open lf-draft offered Save, Cancel and Close, where Cancel discarded the
unsent edit and Close kept it for the next opening. Close duplicated Escape and
asked the user to tell two ways of leaving apart, so the footer now offers Save
and Cancel; Escape still sets the edit aside, and resume writing still finds it.

A draft now carries a Copy control at its top right, as code blocks do, copying
the Markdown source the box shows (the open editor's while it stands). The code
block primitive becomes copyBlock(block, source, noun), so the control's label
names what it copies. The draft reserves the control's corner before upgrade,
so words never run under it and wrap where they first painted.

The draft lifecycle test now leaves through Escape rather than Close, and checks
the copied source while editing and at rest.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/references/module-authoring.md
…s list

The lf-draft editor kept a second idea beside the text box: Escape set unsent
words aside for the next opening, so a closed box could hold words it gave no
sign of, and a Changes list under the box restored earlier saved versions.

Escape now cancels, discarding the editor's changes, as Cancel and a message
rewrite's Escape do; the field's own undo walks typing back, and the page's undo
(z) withdraws a saved edit. The Changes list, its Restore buttons and its styles
are gone, along with alignedNodes, which only that list rendered. The shared
draft store stays, holding only an open editor's words so they survive a reload,
a live revision that replaces the element, and a closed tab.

Recovery now reopens any words the store holds rather than comparing them with
the first reading, which can precede the log's: words that walked a saved edit
back to the authored text were dropped on reload.

Tests that set an edit aside with Escape now step out to the page and leave the
editor open; history assertions are removed, the aligner and action-history
checks are kept, and a new test covers the walk-back reload. The feature gallery
describes the new controls.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	skills/leaf/assets/runtime/code-copy.js
…a tap

The standard copy control stands at a block's top right, hidden at rest and
revealed by hover on desktop; on a phone, sites show it once the user taps
the block, as mobile browsers turn that tap into hover. #2626 had instead
hidden the corner control from a finger on live pages and put "Copy code"
on the banner while the user stood on a block, a pattern no other site
uses.

A tap on a block already stands the user on it (code-copy.js focuses it on
a touch pointerdown), so the corner control now shows on that standing,
for a finger as for a keyboard, and hides when the user leaves. Nothing
covers the first line at rest, and no room is taken: hidden, the control
also takes no presses (`pointer-events: none`), so the words beneath it
stay selectable. An export behaves the same, replacing its own rule that
showed the control at rest and hid it on standing.

The reveal for a widget's control is now one rule, the widget's hover or
focus within, which replaces the draft's own copy of it and gives `lf-code`
the keyboard reveal it lacked. The draft reserves its corner on every
pointer, since its control now shows to a finger while the editor is open.

With no element scope left declaring `touch`, `touchPresses` again reads
page scopes only, and the Touch routes contract drops the element-scope
clause. The journey test now holds that a tap shows the corner control,
which copies, and that leaving hides it and passes presses through.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…at rest

A tap on a hidden control's corner stood the user on the block, which
revealed the control before the tap's click was aimed, so the same tap
copied. A click now copies only when its press began on the shown control;
Enter's click carries no press and still copies. The journey test taps the
hidden corner and finds the clipboard untouched, and fails without the
check.

The draft reserved its corner along its whole body on every pointer, which
on a phone wrapped a one-line draft to two. At rest the control now floats
over the corner as a code block's does; only the open editor, which keeps
the control in view while typing, gives up its corner.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 12, 2026
@max-sixty
max-sixty merged commit e762ad0 into main Oct 12, 2026
3 checks passed
@max-sixty
max-sixty deleted the edit-box-buttons branch October 12, 2026 21:55
leaf-agent added a commit that referenced this pull request Oct 13, 2026
The [main CI
run](https://github.com/max-sixty/leaf/actions/runs/38317918344) found
two draft tests whose arrangements conflict with #2670's editor and Copy
control. The editor deliberately reserves space at its right edge for
Copy; its test now holds the draft frame, text origin, line height, and
selected word steady while checking that reserve. The selection test now
releases its drag over the draft's words, where the browser keeps the
selection endpoint; releasing at the box's far edge selected the
following page content and opened the draft on mouseup.

Both node IDs failed on current `main` before this change and pass after
it with `uv run pytest -q -n0`. No product code changes.

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 13, 2026
… persistent otherwise (#2699)

In the glossary, **Standing** means one thing: the user holding a
destination or a control inside it (a standing target, ending a
standing). Across the tree "standing" was also an ordinary adjective for
things that are in force, current, open or lasting ("the standing log",
"a standing report", `standing_approvals`, `--standing`), which collided
with that term. This rewords every such use and renames the identifiers
with all their callers, leaving "standing" to mean only where the user
is. The glossary gains an **In force** row and a line saying so.

**Replacements, one word per meaning**
- not withdrawn or retracted → **in force** (`InForce`,
`StateProjection.in_force`, `approvals_in_force`, the per-verb
`inForce`); the served field keeps its name `stands`
- the latest value or reading → **current**
- still owed, or a surface on screen → **open** / **active**
- a server or environment that outlives sessions → **persistent** (CLI
`--standing` → `--persistent`, service.json `"lifetime": "persistent"`);
always-present chrome → **fixed**
- a preference → **lasting**; a dispatch → **recurring**; otherwise
**existing**, **present**, **in place**, **permanent**

**Behavior changes**
- `leaf server start --persistent` replaces `--standing`, and refusals
and the lifetime line say "persistent".
- One `server.read_service(page_dir)` now reads `service.json` for every
caller, returning nothing unless the record has its required fields and
a lifetime this Leaf knows. A record an older Leaf wrote with
`"lifetime": "standing"` is therefore no service (root AGENTS.md,
"Stage"), A server that older Leaf started still holds its lease, so
`leaf server stop` and a re-vendor detect it from the lease, delete the
record and wait for it to exit; until then `server start` refuses as
before. A server started persistently before this change is re-served
with `--persistent`.
- Visible wording: "Current text matches this version", the reaction
scope "On a reaction", the margin contribution key `"reactions"`, and
the eval surface `action-in-force` (with its metrics).

**Fixes for journey tests main had broken.** Editing these test files
selects them, and each already failed on main:
- `test_a_comment_box_moves_home_when_a_panel_comes_to_cover_its_seat`
(since #2613 made the Threads dialog's envelope zero-size): it now
checks the dialog is open and its panel visible, as #2639 did for a
sibling.
- `test_each_sampled_focus_ring_is_shown_whole_in_its_surface` (since
#2647): the floating panel's focus rule declares `--lf-focus-ring:
floating-panel`.
-
`test_an_aimed_press_does_only_what_the_outline_promised[release-notes]`
(since #2670 put a Web Awesome Copy control in `lf-draft`):
`elementFromPointAcross` stepped into the control's own shadow tree and
took its internal `id="copy-button"` for a page element, so the aim and
the press both targeted it and no comment landed. The hit test now
enters only shadow roots a widget declares with `x-shadow`, as
`passages.js`'s header already says; the aim takes the `lf-draft`.
-
`test_a_first_complete_read_does_not_repaint_an_already_undone_settlement`
(since #2649 made decision commands wait for the first complete read):
the race it guards moves one read later, so the page takes its first
read before the held Accept and undo; renamed `test_a_complete_read_…`,
assertions unchanged.

The sweep is generated by a script of exact edits plus identifier rules,
so a newer `main` is regenerated rather than conflict-resolved. Root
`AGENTS.md`'s maintainer section ("a standing preference", line 13) is
unchanged.

> _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