Repository navigation
fix(studio): keep Escape in another approval card from denying the active ask - #2332
Merged
Merged
Conversation
This was referenced Oct 14, 2026
peppescg
force-pushed
the
fix/studio-escape-active-card-2258
branch
from
October 15, 2026 08:29
d603b11 to
025a275
Compare
kantord
force-pushed
the
fix/studio-escape-active-card-2258
branch
from
October 15, 2026 08:56
025a275 to
0f6c6de
Compare
kantord
approved these changes
Oct 15, 2026
peppescg
force-pushed
the
fix/studio-escape-active-card-2258
branch
from
October 15, 2026 13:12
0f6c6de to
43f94d2
Compare
Base automatically changed from
feat/studio-provider-display-names-2260
to
main
October 15, 2026 13:20
…approval cards Pin how Escape behaves today on a chat surface that shows approval cards, before Escape learns to tell the active ask's card from another ask's card. The hook tests render the real approval and plan-review cards: - One layer per press: an open menu, then a text selection, the active ask (deny, or iterate a plan), the side panel, the run, and the unsent draft. - Escape from the active ask's card, the composer, a non-approval side panel, or the page denies the active ask, or iterates the active plan. - A held Escape (auto-repeat, or a second keydown before the release) and an Escape that ends an IME composition act on nothing. - Clearing the draft needs a released second press. The workspace and side-thread test pins the same deny through the real surfaces and the exact verdict route. sendAsks takes an optional session id, defaulting to the one it used before, so it can drive the side thread. Refs #2258 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…tive ask With two or more pending asks, Escape from inside a card that isn't the active ask's denied the active ask: a request other than the one the reader was looking at. Escape now answers no ask from another ask's card. Every pending ask's card is marked data-approval-scope, and the active ask's card is also marked data-active-ask. useChatEscape returns at the ask layer when the press comes from a card without that mark. The card's own ask isn't answered either: it isn't the active ask, so no key answers it, which matches #2251's detail panel for such an ask, where Escape only closes. The plan-review card is marked the same way, so Escape from a plan card that isn't the active ask's neither denies the active ask nor iterates the active plan. Unchanged: from the active ask's card, the composer, a side panel that isn't an approval, or the page, Escape still denies the active ask or iterates the active plan. An open menu and a text selection still come first, the double-Escape draft clear works as before, and a held Escape still acts on nothing. Tests cover two asks with focus in the second card (nothing is posted for either ask, on the workspace and the side thread), a plan card that isn't active, every ordinary and plan pairing at the hook, and a selection that still clears from another card. They fail without the fix. Closes #2258 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The Keyboard shortcuts page said only that Escape denies the active request and closes a detail panel showing a different one. It now says, in one sentence, that Escape does nothing in the card of a different request or plan review. The Studio guide defers the full Escape order to that page, so it needs no change. Refs #2258 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
peppescg
force-pushed
the
fix/studio-escape-active-card-2258
branch
from
October 15, 2026 13:20
43f94d2 to
0afc125
Compare
Merged
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of a 4-PR stack: #2329 → #2330 → #2331 → #2332. Review in any order; merge bottom-up.
Summary
With two or more pending asks in a chat, Escape pressed while focus was inside a card that isn't the active ask's denied the active ask. That is a different request from the one the reader was looking at. #2251 fixed the same problem for the approval detail panel; this PR fixes it for the cards.
Escape now answers no ask from another ask's card. From the active ask's card, the composer, a side panel that isn't an approval, or the page, Escape still denies the active ask, as #1975 designed.
The only visible change is one sentence of help text on the Keyboard shortcuts page. The screenshots below show the behavior itself: two pending asks, Escape pressed in the second card, Before and After.
What changed
chat-escape.ts: one helper,inOtherAskCard, and one early return at the ask layer. When the press comes from inside a[data-approval-scope]card that isn't markeddata-active-ask, Escape returns after disarming the draft hint. It sends no deny, no plan iterate, and no unavailable-plan message. The layers above the ask (an open dialog or menu, a text selection) and below it (side panel, run, draft) are unchanged. The diff is 14 added lines and no other edits, so it stays clear of thechat-escape.tscleanups listed in Large batch of tiny follow-up fixes #2303 section B.approval-panel.tsx: the card is markeddata-active-askwhile it shows the surface's active ask. The mark comes fromuseActiveEscapeAsk, the same check behind the card's "Esc to Deny" hint and its letter keys, so Escape denies from the card that shows "Esc to Deny".plan-review-card.tsx: the plan-review card is markeddata-approval-scope, anddata-active-askwhile it shows the active ask, so the rule covers plan cards too. This includes a stale plan card from an older run next to the current plan: it keeps its Raw arguments toggle, and Escape from there used to iterate the current plan. Letter keys don't change: plan cards never had them, and from inside a plan cardapprovalOwnsKeystill matches no ordinary card.user-docs/operating/studio.mdis unchanged: docs(studio): shrink the Escape section to what the app does not show #2314 removed the sentence this PR edited, and the guide now defers the Escape order to the Keyboard shortcuts page. See "Overlap with docs(studio): shrink the Escape section to what the app does not show #2314 and fix(studio): make the Escape double-press window strictly under 500 ms #2318" below.Overlap with #2314 and #2318
This PR overlapped #2318, which also edits
chat-escape.tsandapproval-interactions.test.tsx, and #2314, which removed thestudio.mdEscape sentence that this PR edited. Both have merged, and this branch is rebased onto them: it keeps #2314's removal of thestudio.mdsentence, and the Keyboard shortcuts sentence here still applies.Escape from another ask's card
The issue allowed Escape to act on that card's own ask or to do nothing. It does nothing:
Denying stays the only verdict Escape gives. Escape never approves.
Behavior kept on purpose
No regression
Pins first
62655918fadds tests only, before any product change. It passed onmain(42b933fb4) and passes on this branch, unchanged.chat-escape.cards.test.tsx(new, 6 tests) runsuseChatEscapeon a surface with the real approval and plan-review cards, as in the workspace and the side thread:approval-interactions.test.tsx(1 test) runs the real workspace and side thread through the exact verdict route. With two pending asks, a held Escape in the active card posts nothing, and a press there denies ask 1. A press from outside every card then denies ask 2: from the workspace's composer, or from a thread control, because the thread's composer is disabled while its run waits.The pins catch the guards they cover. Removing the repeat guard, the unreleased-key guard, or the IME guard, or moving the panel layer above the ask, fails them.
New tests
deebcd319adds 5 tests with the fix.In
chat-escape.cards.test.tsx:In
approval-interactions.test.tsx:Mutation proof
With every test in place, the product files were put back to
main's version, all together and then one at a time:mainchat-escape.tsonlyplan-review-card.tsxonlyapproval-panel.tsxonlyThe last row shows the pins also guard the fix: without the active card's mark, the hook would treat the active ask's own card as another card, and Escape would stop denying from it.
Existing tests
No existing test was modified or deleted, and all pass with their assertions unchanged. That includes
chat-escape.test.tsx,approval-shortcuts.test.tsx,approval-panel.test.tsx,plan-review.test.tsx, the rest ofapproval-interactions.test.tsx(#2251's "closes a detail panel on Escape instead of denying a different ask" among them), and thee2e/chat-approval.spec.tsjourneys.The one helper change:
sendAsksinapproval-interactions.test.tsxtakes an optional session id, defaulting to the one it used before, so it can drive the side thread. Its existing calls are unchanged.Gates
All gates ran through the shared gate lock. This PR's base is #2331 (
f4369bd0e), and this branch, the top of the stack, is43f94d286.43f94d286)main(see #2331)task studio:browser)The server failure is
routes/knowledge.test.ts, whichmainfails at4aa238f3ctoo; #2355 fixes it. After the rebase this PR changes no Markdown, sotask docsdoes not apply.Screenshots
Captured with a throwaway Playwright journey (Chromium, not committed) on the offline BFF fixtures in
apps/web/e2e/fixtures.ts:Europe/Rome, and the locale is en-US.main(42b933fb4) and after is27c6e6afc, this PR's head before the stack rebase; the rebased43f94d286carries the identical patch, without thestudio.mdsentence that docs(studio): shrink the Escape section to what the app does not show #2314 removed. Each tree was captured twice. The two runs matched pixel for pixel, apart from 22 and 32 px in two Before phone frames.The journey also logged the verdicts each press posted. Across both runs, all 16 Before journeys posted
denyfor the first ask when Escape was pressed in the second card, and all 16 After journeys posted nothing.The Prototype column is the prototype (
stack-08) with the same two asks. The prototype renders only the first pending ask as a card, with a "1 of 2" badge, so it has no second card to press Escape in. Its column shows that card in both Escape frames.Escape in the second card
Just before Escape
Focus is on the second card's Raw arguments toggle, with its focus ring. The first card is the active ask: it shows the Y, W, and N keycaps and "Esc to Deny". Before and After are identical, pixel for pixel, because the fix changes nothing until the key is pressed. Deliberate difference from the prototype: Studio shows every pending ask as its own card, while the prototype shows only the first, with a "1 of 2" badge. The card itself is #2251's port of the prototype's card.
Dark, phone, and the whole page
Both cards, desktop, dark:
Both cards, phone, light:
Both cards, phone, dark:
Whole page, desktop, light:
Whole page, desktop, dark:
Whole page, phone, light:
Whole page, phone, dark:
After Escape
In the whole-page frames, two of the small boxes, on the Stop button and the composer placeholder, are anti-aliasing after the transcript re-renders. The third is on the minimap rail, which has one marker fewer in Before. The prototype column repeats its one card. Deliberate difference from the prototype: the prototype's Escape denies its one visible ask from anywhere on the page, even while typing. Studio's Escape answers only from the active ask's card or from outside every card.
Dark, phone, and the whole page
Both cards, desktop, dark:
Both cards, phone, light:
Both cards, phone, dark:
Whole page, desktop, light:
Whole page, desktop, dark:
Whole page, phone, light:
Whole page, phone, dark:
Keyboard shortcuts page
The last paragraph of the "Escape in a chat" card replaces "A detail panel showing another request closes on Escape." with "Escape closes a detail panel showing another request and does nothing in another request's card." Deliberate difference from the prototype: the prototype has no "Escape in a chat" card. Its only Escape description is the General card's Esc row, shown in its column.
On the phone page frames, the box covers the whole card: the new sentence adds a line, and the centered card moves with it. The card crops box only the changed lines.
Dark, phone, and the whole page
Card, desktop, dark:
Card, phone, light:
Card, phone, dark:
Whole page, desktop, light:
Whole page, desktop, dark:
Whole page, phone, light:
Whole page, phone, dark:
Closes #2258
Part of #2210
🤖 Generated with Claude Code