Skip to content

Keep the page still when ⌘Z brings back a deck card an answer moved on from - #7369

Merged
max-sixty merged 2 commits into
mainfrom
undo-viewport-shift
Nov 27, 2026
Merged

max-sixty merged 2 commits into
mainfrom
undo-viewport-shift

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

⌘Z after an answer in a deck no longer scrolls the page. The answer hides its card, so undo read the widget as out of view and travelled to it as a link to its fragment would: a navigation that lands the element's start at the window's top even where it already shows, writes #id into the address and adds a Back step. On a copy of the page where this was reported, that scrolled 452 px though the card came back where it had stood. Undo now uses anchor travel's ordinary arrival for an element: reveal it where it stands, put the user on it, and scroll it to its start only where it isn't shown there already (the rule navigateToDatum uses). Same page, Chromium and Firefox: scroll stays at 0, focus on the options, address and history unchanged.

To weigh: no undo route adds a Back step now, threads included, so Back after an undo no longer returns to where the user pressed. returnToThread loses its history option, which every caller now passes the same way.

Left alone: ⌘Z within the 260 ms a card takes to fly off leaves the next card up, since the leaving card is still painted. Fixing it means teaching the views prepaint that a leaving member is hidden. None of the 29 undos in this machine's page logs came that fast; the fastest came 1.0 s after its gesture.

Asked for by max-sixty on a Leaf page; reviewed by Codex. Tests: a new deck case (fails before: 199 px scroll), two travel cases updated, and 67 undo tests pass.

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

…n from

Undoing an answer in a deck scrolled the page: on a copy of a page the
user was working through, ⌘Z after picking an option scrolled 452 px and
left the card's options 22 px from the window's top, though the card
came back where it had stood, wholly in view (Chromium and Firefox,
1440x900). The answer had hidden its card (`hidden="until-found"`), so
undo read the widget as out of view and travelled to it as a link to
`#o-tend-1744` would: a fragment navigation, which lands the element's
start at the window's top even where it shows, writes the fragment into
the address and adds a Back step. That route dates from show-then-take,
when travelling was the whole job of an undo's first press.

Undo now arrives at an element with anchor travel's ordinary arrival:
it reveals the element where it stands, opening what hides it, puts the
user on it, and scrolls it to its start only where it isn't shown there
already, the rule `navigateToDatum` lands a widget's datum by. On the
same page the scroll stays at 0, the options stand at 474 px where they
stood, focus is on them, and history and the address are unchanged. A
widget scrolled far out of view still lands at its start, as before.

No undo route adds a Back step any more: the thread and message routes
pass `history: false`, so `returnToThread` loses its `history` option,
which every caller now set the same way. Back after an undo goes to
the entry before it rather than to where the user pressed; the docs'
Undo paragraph and the history header no longer promise that step.

Tests: a deck case that answers a card, waits for the next to land,
presses ⌘Z and checks the card's options stand where they stood with
focus on them (it fails before this change, scrolling 199 px). The
far-choice case now checks focus and an unchanged address instead of
Back returning; the walk case checks focus instead of the fragment.

Left as it was: a ⌘Z within the 260 ms a card takes to fly off takes
the answer back but leaves the next card up, since the leaving card is
still painted and undo reads it as seen. Bringing it back would need the
views mechanism to treat a leaving member as hidden, a change to the
prepaint for a window none of this machine's 29 undos came within (the
fastest came 1.0 s after its gesture).
@max-sixty
max-sixty merged commit 338b74d into main Nov 27, 2026
6 checks passed
@max-sixty
max-sixty deleted the undo-viewport-shift branch November 27, 2026 07:52
max-sixty added a commit that referenced this pull request Nov 27, 2026
Comment only. `undo.js`'s header now names the simpler design that is
open should undo's press-time reading of visibility keep needing fixes:
⌘Z returns the user to where they stood when they made the gesture in
this tab (`records/history.js`, `readPlace`) and otherwise moves nobody,
giving up travel to a gesture made far away.

That reading has needed three fixes (#6429, #6460, #7369), and #7396 is
a fourth case it misreads, a widget hidden in a closed disclosure. All
29 undos in this machine's page logs came within 33 s of their gesture,
so none needed the far travel.

Asked for by max-sixty after #7369.

> _This was written by Claude Code on behalf of max-sixty_
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