fix(host): restart home on early-edit cancel; clamp the dialog to short viewports

Escape canceling a path edit opened before any level listed relaunches
the home listing instead of stranding a blank picker (the editor had
superseded the initial request while parent was still null). The card's
height clamps to the viewport (min(420px, 100dvh - 32px)); header and
footer are flex-none and the columns scroll, so Open/Cancel stay
reachable on landscape phones and short embedded windows.
This commit is contained in:
creatixchu
2026-07-29 04:46:49 +08:00
parent 48141b0007
commit 1a9b84b19e
4 changed files with 34 additions and 5 deletions

View File

@@ -1,12 +1,15 @@
/* Directory-browser dialog (figma 813-23126 family). The shared Modal renders
* headless here — mask, card, Escape only — and this module owns the figma
* frame exactly: fixed 600×420 card, header (title + crumbs, l3 separator),
* frame: 600×420 card (viewport-clamped), header (title + crumbs, l3 separator),
* the one-or-two-column Miller content, and the bordered footer. */
/* Doubled class beats Modal's own .dialog regardless of stylesheet order. */
/* Short viewports clamp the card: header/footer are flex-none and the
* columns scroll, so shrinking the height keeps Open/Cancel reachable
* instead of clipping them below a fixed overlay. */
.dialog.dialog {
width: min(600px, 100%);
height: 420px;
height: min(420px, calc(100dvh - 32px));
padding: 0;
gap: 0;
}

View File

@@ -1,6 +1,7 @@
/**
* The in-app workspace-directory browser (figma Harness 813-23126 family): a
* fixed 600×420 dialog whose header carries the title, the selection-path
* 600×420 dialog (clamped to short/narrow viewports — the Miller row scrolls
* sideways, the columns scroll down) whose header carries the title, the selection-path
* breadcrumb, and a click-to-edit path zone; below it a Miller view — one
* full-width level until a row is selected, then two 256px columns (level |
* selected folder's children) around a hairline divider. Selecting in the
@@ -364,6 +365,10 @@ export function DirectoryBrowser({ open, listDirectory, createDirectory, onOpen,
// half-empty two-pane view, so cancel falls back to the
// single-pane level.
if (child === null) setSelected(null)
// With no level listed yet (the editor superseded the
// initial home listing), plain cancellation would leave a
// permanently blank picker: restart the home listing.
if (parent === null) navigate()
}
}}
/>