fix: keep Escape in the first-deploy dialog's overlays from stepping it back

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Guilhem Lemouel
2026-11-02 02:07:42 -08:00
co-authored by Claude Opus 5.5
parent 013735d6bc
commit 81e1307692
2 changed files with 12 additions and 1 deletions
@@ -56,6 +56,9 @@
* can see the key at all.
*/
enterConfirms?: boolean
/** Off while something opened from inside that is not an overlay of its own (a select
* dropdown, a portalled confirmation) owns Enter and Escape. */
keyListen?: boolean
/** Make the dialog fill the height it is anchored to and lay its body out as a flex
* column, so content can size itself with `h-full` / `flex-1 min-h-0`. Off by default:
* the dialog otherwise hugs its content, and percentage heights inside it do not
@@ -94,6 +97,7 @@
fitHeight = false,
paginated = false,
enterConfirms = true,
keyListen = true,
minZIndex: minZIndexProp = undefined,
titleBadge,
levelBadge,
@@ -147,7 +151,7 @@
// `preventEscape` below keeps Escape for this dialog, so nothing else arbitrates between it
// and an overlay stacked over it (a drawer opened from inside): ask before acting.
if (!disposable?.isTopmost()) return
if (open) {
if (open && keyListen) {
switch (event.key) {
case 'Enter':
if (!enterConfirms) break
@@ -68,6 +68,8 @@
let open = $state(false)
let step = $state<'details' | 'runAs'>('details')
let pickerOpen = $state(false)
let overlayOpen = $state(false)
let kind = $state<ShareKind>('flow')
let summary = $state('')
let path: string | undefined = $state()
@@ -149,6 +151,8 @@
}): Promise<FirstDeployChoice | undefined> {
resolve?.(undefined)
step = 'details'
pickerOpen = false
overlayOpen = false
kind = opts.kind
runAsWorkspace = opts.runAs?.targetWorkspace
runAsEmail = opts.runAs?.email
@@ -238,6 +242,7 @@
: undefined}
kind="X"
enterConfirms={false}
keyListen={!pickerOpen && !overlayOpen}
fitHeight
class="sm:max-w-xl"
>
@@ -256,6 +261,8 @@
rawApp={kind === 'raw_app'}
itemPath={path}
{needsSource}
onPickerOpenChange={(o) => (pickerOpen = o)}
onOverlayChange={(o) => (overlayOpen = o)}
/>
<div class="flex flex-row justify-end gap-2">
<Button variant="default" unifiedSize="md" onclick={() => (step = 'details')}>Back</Button>