Skip to content

One owner decides what a margin card shows and where focus lands after a reading #7564

Todo

Description

@max-sixty

After a reading or a gesture changes what a margin card shows, several pieces of code each decide which thread the card shows next and where focus goes, and each reacts to the focus move the one before it made, inside one task. The final state is whatever ran last. Whenever two of them follow different rules, the user sees a focus bug, such as the card showing one thread while the focus ring stands on the page, and each such bug is found by hand.

The case that shows it

Two threads on one list item, one on the whole item and one on a phrase in it, stand in two margin rows of one target. With focus on the first in its card, r resolves it. Before #7563, the card then showed the second thread while focus and its ring stood on the list item. Three pieces ran in one task:

  1. The margin's render (renderNow, margin-projection.js) saw the card's row empty and closed the card. Its default letGo() let the user go from a paragraph at the top of the window, unrelated to the thread.
  2. The settlement's landing (thread-preview.js) focused the target.
  3. followCurrentLocation (margin-projection.js) saw a keyboard arrival at a target that still holds a thread, and opened the card beside the target with that thread.

On other paths, the thread pass (holdThreadPlace, records/thread/focus.ts) and the card's rebuild (holdFocus in buildThreadCard) also move focus around the same reading.

#7563 makes the render ask where the card's thread went, and use step 3's rule for the next thread at a target, so the three agree for this case and for the seat, revision, withdrawal and Back cases a review found. The chain itself stays.

Owners of the same question

Each of these picks the thread a user is at, or the one that comes next, by its own rule:

  • buildThreadCard (thread-preview.js): the next or previous thread within a card's row.
  • followCardThread / showNextAtTarget (margin-projection.js): the card's thread in its new row, else the next at its target.
  • resolveLanding (panel/floating-panel.js): the next thread in Threads order.
  • restoreCard / restoreCurrentLocation (margin-projection.js): after a revision that replaces the document, looked up by the card's old row.
  • threadIdsAt / threadEntryAt / accompany (margin-projection.js, features/annotation-inventory.ts): the thread a keyboard arrival at a target shows.
  • threadHere / threadAtCurrentLocation (records/thread/destination.ts): the thread a key acts on.

A gap the current structure leaves: the card's session belongs to its row, so a thread a revision moves to another row opens there afresh, and a reader who had read back in a long transcript lands where an opening lands. Keeping the session across rows kept the place but hid the quote the revision adds under the card's head line, since the kept transcript scrolled it out of view (which mechanism, the end-keeper followEnd or the browser's scroll anchoring, is unconfirmed).

Proposal (unconfirmed)

Keep the user's place at a target (the target, the thread, and whether they are in the card or beside it) as state that one owner computes from the page's reading and the gesture. The card's content and the focus are drawn from that state, and focus is applied once, after the place is decided. This is the Model and view split that porting the margin card and the margin projection to Effect UI brings (browser/AGENTS.md, "Renderers"), with focus as an HtmlCommand. Doing it before that port would mean writing it twice.

Trigger

The port of thread-preview.js and margin-projection.js to Effect UI. Assigned to Max: he wants to check this then, and the design needs his go-ahead before it's built, since it changes how the runtime decides focus for every margin card.

Done when

  • One owner decides, for each reading and gesture, which thread the card shows and where focus lands; the pieces above read its decision instead of moving focus themselves.
  • A probe that logs focusin across a Resolve, an agent's resolve, a withdrawal, a revision that moves a quoted thread, and a thread seated by a widget shows focus landing once, on what the final state holds.
  • A thread moved to another row keeps the reader's place in its transcript and shows the revision's quote.
  • tests/browser/threads/test_resolving.py's card tests pass unchanged.

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

Activity

  1. added
    backlog
    on Nov 28, 2026
  2. self-assigned this
    on Nov 28, 2026
  3. added
    etc
    ux
    on Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backlogetcux

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions