Agent Zero AI framework
Converge crumb truncation synchronously before paint
linkliti5c5e550baae5
diff --git a/tests/test_file_browser_navigation.py b/tests/test_file_browser_navigation.pyindex 51ca3a197..78651fc9d 100644--- a/tests/test_file_browser_navigation.py+++ b/tests/test_file_browser_navigation.py@@ -158,12 +158,14 @@ def test_file_browser_seamless_navigation_and_row_click_contract() -> None:def test_file_browser_overflow_measure_reacts_to_navigation_contract() -> None:"""Crumb fit measurement must re-run per navigation, not only on resize."""html = read("webui", "components", "modals", "file-browser", "file-browser.html")+ store = read("webui", "components", "modals", "file-browser", "file-browser-store.js")start = html.index('x-effect="$store.fileBrowser.pathCrumbs()')end = html.index('@click.self="$store.fileBrowser.startPathEdit()"', start)crumbs_effect = html[start:end]assert "$store.fileBrowser.pathCrumbs()" in crumbs_effect- assert "measurePathCrumbFit($el)" in crumbs_effect+ assert "requestAnimationFrame(() => $store.fileBrowser.measurePathCrumbFit($el))" in crumbs_effect+ assert "hidden = measure(available - 18);" in storedef test_file_browser_compact_controls_and_narrow_layout_contract() -> None:diff --git a/webui/components/modals/file-browser/AGENTS.md b/webui/components/modals/file-browser/AGENTS.mdindex 5f69c5d89..c250b333f 100644--- a/webui/components/modals/file-browser/AGENTS.md+++ b/webui/components/modals/file-browser/AGENTS.md@@ -60,7 +60,7 @@- Crumb buttons carry a thin `›` separator as part of the left folder button (inside its hover box, decorative only, hidden on the rightmost crumb) with reduced inter-crumb gap, `var(--font-size-small)` text, and the rightmost (current) folder bold at full opacity. Path bar buttons, icons, and the raw input share the same smaller sizing.- No dedicated Edit toggle button on the breadcrumbs line: empty path-line space enters edit via `startPathEdit()`. The line ends in a reserved slot (`.path-edit-toggle` span, constant 26px, `aria-hidden`, itself a click target for `startPathEdit()`) that paints its spinner through `.path-edit-toggle.is-loading::before` — spinner while loading, empty when idle, never overlaps or shifts crumb text; never reintroduce a nested spinner element or a clickable toggle button.- Edit-entry zones use the text cursor: `.path-buttons-group` frame (it owns the field border/gap/padding, so its gaps are click targets via `@click.self`), `.path-crumbs` empty space, `.path-input-shell` gap strip, and the reserved slot all carry `cursor: text`; crumb buttons keep `cursor: pointer`. The submit button (`path-submit`) takes `cursor: text` from the high-specificity `.file-browser-header-button.path-submit` block — the later generic `.file-browser-header-button { cursor: pointer }` would win the tie; scope its `:disabled` wait cursor the same way.-- On overflow the bar hides whole crumbs that would render partially (never clipping names). The left-chevron button (`.path-overflow-up`) takes its 16px slot only while crumbs overflow; `.is-hidden` collapses it with `display: none` when they fit — a class toggle on the mounted button, never `x-show`, and the freed width re-runs the crumb-fit observer so the bar re-measures. It opens a dropdown listing all ancestor folders in path order (root first) and closes on pick, outside click, or Escape. Crumb buttons carry no tooltips — no native `title`, no tooltips-store conversion; the crumb names are the label.+- On overflow the bar hides whole crumbs that would render partially (never clipping names). The left-chevron button (`.path-overflow-up`) takes its 16px slot only while crumbs overflow; `.is-hidden` collapses it with `display: none` when they fit — a class toggle on the mounted button, never `x-show`. `measurePathCrumbFit` converges synchronously: when a fresh overflow would reveal the chevron, it re-measures against the width minus the chevron's 18px slot (16px button + 2px gap) in the same pass, so truncation and the chevron are correct before the first paint; the fit re-measure is scheduled through `requestAnimationFrame` rather than `$nextTick` because Alpine drains next-tick callbacks in a macrotask after the remount paints, which flashed an untruncated bar when leaving edit mode; later container resizes still re-run the crumb-fit observer. It opens a dropdown listing all ancestor folders in path order (root first) and closes on pick, outside click, or Escape. Crumb buttons carry no tooltips — no native `title`, no tooltips-store conversion; the crumb names are the label.- Crumb buttons accept drag-and-drop moves like the Up button; the path bar style is configurable in Files settings under Appearance and defaults. Navigating to the already-current directory is a no-op (no refetch, no history push); `navigateToFolder` owns this guard for all callers (crumbs, overflow menu, tree).- Toolbar Back/Forward buttons (`nav-history-button`) navigate the directory history for both path bar modes. `pushNavHistory(path)` is the only entry point for fresh navigations (`navigateToFolder`, `submitPath`, `navigateUp`) and clears `forwardHistory`; `navigateBack`/`navigateForward` move paths between the `history` and `forwardHistory` stacks only after a successful fetch (`preserveOnError: true` keeps the current folder and restores the stack on failure). Both stacks reset in `destroy()` and `resetOpenState()`.- New file uses the existing Save As picker and creates an empty file in the shared Editor; existing names must never be overwritten. When this browser is already live (open modal or mounted canvas surface), picker requests reconfigure the instance in place through `open()` (`resetOpenState` + `loadOpeningPath`) instead of stacking a second browser window; the original modal close awaiter stays intact, and surface pickers restore the browser listing through `restoreBrowserAfterInPlacePicker()` on confirm/cancel. HTML/XML/SVG retain Browser preview in their action menu and use the same dropdown Edit entry as other editable files.diff --git a/webui/components/modals/file-browser/file-browser-store.js b/webui/components/modals/file-browser/file-browser-store.jsindex a91a264ca..065337fde 100644--- a/webui/components/modals/file-browser/file-browser-store.js+++ b/webui/components/modals/file-browser/file-browser-store.js@@ -945,7 +945,10 @@ const model = {crumb.style.display = "";});// The flex layout already subtracts the visible parent-menu button from this width.- const hidden = measure(element.clientWidth);+ const available = element.clientWidth;+ let hidden = measure(available);+ // A fresh overflow reveals the chevron and shrinks the bar by its 16px slot + 2px gap; converge synchronously so truncation never paints a frame late.+ if (hidden > 0 && !this.pathCrumbsOverflow) hidden = measure(available - 18);crumbs.forEach((crumb, index) => {crumb.style.display = index < hidden ? "none" : "";});diff --git a/webui/components/modals/file-browser/file-browser.html b/webui/components/modals/file-browser/file-browser.htmlindex fc076b2e1..298c2d17d 100644--- a/webui/components/modals/file-browser/file-browser.html+++ b/webui/components/modals/file-browser/file-browser.html@@ -137,7 +137,7 @@class="path-crumbs"role="navigation"aria-label="Directory path"- x-effect="$store.fileBrowser.pathCrumbs(); $nextTick(() => $store.fileBrowser.measurePathCrumbFit($el))"+ x-effect="$store.fileBrowser.pathCrumbs(); requestAnimationFrame(() => $store.fileBrowser.measurePathCrumbFit($el))"@click.self="$store.fileBrowser.startPathEdit()"><template x-for="(crumb, index) in $store.fileBrowser.pathCrumbs()" :key="crumb.path">