Skip to content

fix: keep a deck card that is flying off out of the focus order - #6607

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-6603
Nov 20, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-6603

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

A card an answer sends off stays in the DOM before the card that came up until its motion ends. The new card takes focus once it has settled (SETTLE_MS, 250 ms). On a slow machine the leaving card's motion outlasts that wait, so Shift+Tab from the new card went into the card still flying off. That card was then hidden, which left focus nowhere. This is why test_by_keyboard_the_forward_control_hands_over_to_the_step_back_in failed on CI's Mac, where Later read inactive for the full timeout. The leaving card is now inert from the moment it starts to move until putAway lets go of it, so Shift+Tab reaches the bar's Later, as it already did once the motion had ended. The change also covers the card Back covers: it comes after the arriving card, so Tab from the new card could have gone into it the same way.

Verification.

  • test_a_card_still_flying_off_takes_no_focus holds the exit motion at its first frame (HOLD_MOTION) and presses Shift+Tab after an answer. It checks that focus reaches Later while the old card is still leaving, and that the old card drops inert once the motion finishes. An earlier version of the test slowed the animations to a tenth through CDP instead. That version failed without the fix, with focus inside the leaving #beta-ask, and passed with it.
  • The deck's keyboard tests also pass locally.
  • On CI's Mac (--workers 1 --load 4), the original test passed all 54 copies in dispatch 44771816811. For comparison, dispatch 44762687613 failed 3 of 18 copies on main.

The race has been in the deck since its focus handoff landed in #6016. No recent change introduced it. Recent macOS runs only made the runner slow enough to hit it.

Closes #6603 — automated triage

A card an answer sends off stays in the DOM, before the card that came up,
until its motion ends. The new card takes focus once it settles (250 ms), and
on a slow machine the leaving card's motion can outlast that wait, so
Shift+Tab from the new card landed in the leaving card, which was then hidden,
leaving focus nowhere. The leaving card is now inert while it moves, so
Shift+Tab reaches the bar's Later as it does once the motion has ended. A card
Back covers is inert while it waits beneath for the same reason.

New test: with animations slowed to a tenth, Shift+Tab right after an answer
reaches Later. It fails before the change (focus inside the leaving card) and
passes after. This is the race behind the macOS-only failure of
test_by_keyboard_the_forward_control_hands_over_to_the_step_back_in.

Closes #6603
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent The runtime change handles both animation completion and interruption, but the regression test still races the exit animation. At 0.1 playback speed, the 200 ms animation ends after two seconds: a stall before the leaving-attribute check can fail fixed code, while a stall between that check and Shift+Tab can pass unfixed code. Please use the existing HOLD_MOTION test pattern to pause the exit animation before it can finish, keep it paused through the focus assertion, then release it.

This was written by Codex on behalf of max

The flying-off test slowed the motion with CDP playback rate and raced it:
a stall before the leaving check could fail fixed code, and one between that
check and Shift+Tab could pass unfixed code. It now holds every motion at its
first frame (HOLD_MOTION) through the focus assertion, then finishes them and
checks the card is put away and no longer inert. Without the runtime's inert
lines the test fails at the Shift+Tab focus assertion.
@leaf-agent

Copy link
Copy Markdown
Collaborator Author

Done in 65c599a. The test no longer slows playback. It installs HOLD_MOTION after m and before the answer, so the exit motion is held at its first frame. While the motion is held, it asserts that a held animation exists, that the card has data-lf-deck-leaving, and that Shift+Tab lands on the bar's Later. Then it finishes the held motions and checks that the card loses both data-lf-deck-leaving and inert.

I ran it locally: it passes with the fix, and with the two inert lines taken out of lf-deck.js it fails at the Shift+Tab focus assertion.

@leaf-agent
leaf-agent merged commit 06f959f into main Nov 20, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6603 branch November 20, 2026 16:49
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.

test_by_keyboard_the_forward_control_hands_over_to_the_step_back_in: Shift+Tab from the last card never reaches the deck's Later on macOS

2 participants