ModalBreadcrumb
HkModalBreadcrumb is the breadcrumb of open windows rather than of pages: a centred strip over the app header that lists the layer stack — every modal and drawer, plus any dropdown-kind surface that is currently blocking the page the way a window does — and lets the user step back out of it. It renders nothing at all until the stack holds two layers, because a single window has nothing to navigate between.
- The strip's layers are the popup layer stack, not the router: for a trail through routes use a plain link breadcrumb, and for the surfaces that stack see HkModal, HkDrawer and HkPopover.
- Each crumb shows one layer's name (cut to a label budget); the full stack, topmost first and with whole names, lives in the "…" menu — the strip is a navigation aid, not a full inventory.
- The strip is chrome, not a dialog: it opens no window of its own, and asking to close layers above a pick is a request — a layer whose owner registered no close channel simply stays put.
Import
;
use *; // ModalBreadcrumb, ModalBreadcrumbProps, ModalBreadcrumbLayer
use *; // rsx!, VNode, EventHandler, PopoverAnchorRect
The Rust form is a plain function, ModalBreadcrumb(ModalBreadcrumbProps { … }). Every prop may be omitted inside rsx!; an omitted layers is an empty stack, which renders nothing — the same as Vue's visible gate.
The stack and its crumbs
The strip sorts the layers it is given by z_index — the stack's paint order, so the topmost window is the last crumb — and keeps the window kinds (modal, drawer) unconditionally, plus any other kind only while it is blocking. A blocking flag is what a dropdown-kind surface carries while it is docked as a bottom sheet; an anchored desktop menu is a non-blocking attachment and never appears here. Each surviving layer becomes one crumb, and the current (topmost) one takes the accent class so the eye lands on where the user actually is; the crumbs are separated by a chevron.
A layer that carries no name is not left nameless: it falls back to a localized last resort — "Window" for a window kind, "Menu" for a dropdown-kind surface — so an unnamed window still reads as a window instead of a bare "Layer 3". An empty title takes the same fallback too, because Vue's title || fallback is a truthiness test rather than a null check.
max_label_units is the longest a label may render, in full-width glyph units (one CJK ideograph is 1, one Latin glyph 0.5), and the ellipsis counts inside that budget. A label that fits is rendered byte for byte; one that does not is cut and becomes a tappable crumb that reveals the whole name (see the last section).
The two halves of this pair are not symmetric, and the reason is the source of the stack. Vue has no layers prop at all: it reads the app's popup registry, so the only way to give the strip something to show is to open real windows, which a documentation page must not leave behind. The TSX half therefore renders the component with no stack, which is also the honest description of its default state — nothing at all. The Rust half takes the stack as a prop and is a complete, self-contained three-layer strip.
Fold, trigger and menu
When the stack is wider than the strip, the leading layers fold behind a "…" trigger; the tail keeps rendering normally, and the trigger stays mounted whenever its menu is open. Which prefix folds is decided from measured widths in Vue and from the pure maths in Rust, but the answer is the same in both: the longest visible tail wins, and the last layer is never folded away — if even the current layer alone overflows, it keeps the strip and its own ellipsis.
hidden_count is how many leading layers sit behind the trigger, and it is clamped so the tail always keeps at least the current layer. The trigger is a real <button> with aria-haspopup="dialog" and aria-expanded following the menu; the menu it opens lists every layer, topmost first, with full names that the strip's clamp never reaches. Picking a row asks the host to close everything stacked above that layer.
The folded strip above is the Rust form only; the TSX counterpart is the same empty <HkModalBreadcrumb /> as in the previous pair, which renders nothing without a registry stack.
What the two forms differ on
Vue measures the live DOM: an off-screen clone of every crumb is the strip's ruler, the app header gives it its centre line, a ResizeObserver re-decides the fold when a webfont swap moves a box, and a slow tick re-derives the top. The strip also teleports into the overlay root, publishes its top band onto <body> for the sheet family, and owns Escape for its two popovers.
[D] The Rust mirror has no measurement API: hidden_count, strip_top_px and max_width_px are host-supplied, None paints on the fallback geometry (one gap above plus half the strip's 43px height), and the clone still renders so a host that measures it gets the same ruler. The maths that turns measurements into those values is exported as plain functions — modal_breadcrumb_fold_count, modal_breadcrumb_content_budget, modal_breadcrumb_strip_top, modal_breadcrumb_sheet_band.
[D] There is no teleport, no overlay root and no popup registry: the strip renders where it is placed, the layer list arrives as the layers prop, and the menu therefore cannot drop its own registered sheet the way Vue's menu does — a host whose menu popover registers as a blocking layer must leave that id out of layers itself. [D] Escape is owned by the mirrored Popover for its own panel; a host that needs the strip inside a wider Escape chain mounts it there. The all-layers rows are HkMenuPanel / HkMenuActionItem DOM hooks (hk-menu-list, hk-menu-action-item) rendered by this component, not instances of those components.
API
Vue
Props
| Name | Type | Default | Required |
|---|---|---|---|
| appRootId | String | "app" | — |
| headerSelector | String | ".hk-glass-header" | — |
| headerFallbackHeight | Number | 48 | — |
| maxLabelUnits | Number | 10 | — |
| topGap | Number | 12 | — |
Rust
Props — ModalBreadcrumb
| Prop | Type | Default | Description |
|---|---|---|---|
| layers | Vec<ModalBreadcrumbLayer> | [] | The popup stack, straight from the host's registry (Vue reads the popup manager's); only the window-like layers join — see modal_breadcrumb_stack. |
| max_label_units | f64 | MODAL_BREADCRUMB_DEFAULT_MAX_LABEL_UNITS (10.0) | Longest a layer label may render, in full-width glyph units (Vue: maxLabelUnits, default 10). |
| top_gap | f64 | MODAL_BREADCRUMB_DEFAULT_TOP_GAP_PX (12.0) | Least daylight between the app's top edge and the strip's (Vue: topGap, default 12; non-finite falls back to it). |
| hidden_count | usize | 0 | How many LEADING layers sit behind the "…" trigger (Vue's hiddenCount ref — controlled here; the pure modal_breadcrumb_fold_count computes it from measurements). |
| menu_open | bool | false | The all-layers menu's visibility (Vue's menuOpen ref). |
| revealed_id | Option<String> | None | The truncated label whose whole name is revealed (Vue's revealed ref, by crumb id); the surface renders only while the id names a TRUNCATED crumb still on the stack (Vue's watcher contract). |
| strip_top_px | Option<f64> | None | The strip's inline top (Vue's topPx ref). |
| max_width_px | Option<f64> | None | The viewport fence as local px (Vue's maxWidthPx ref — the sheet keeps its own 100vw fence when None). |
| menu_anchor | Option<PopoverAnchorRect> | None | The trigger rect the menu popover anchors against (Vue wires the trigger's own ref; the mirrored Popover takes geometry). |
| reveal_anchor | Option<PopoverAnchorRect> | None | The crumb rect the reveal popover anchors against. |
| on_open_menu | Option<EventHandler<()>> | None | The "…" trigger was pressed (Vue's openMenu — which also closes any open reveal; the host owns that mutual exclusion). |
| on_close_menu | Option<EventHandler<()>> | None | The all-layers menu asked to close (its popover's update:modelValue(false) — backdrop, grabber, Escape). |
| on_toggle_reveal | Option<EventHandler<String>> | None | A truncated, visible crumb was pressed (Vue's toggleReveal — the host toggles revealed_id, closing the menu when it opens one). |
| on_reveal_close | Option<EventHandler<()>> | None | The reveal surface asked to close. |
| on_navigate | Option<EventHandler<String>> | None | A layer was chosen from the all-layers menu (Vue's selectLayer → manager.closeAbove(id)): everything stacked ABOVE that layer is asked to close, top-down — the host owns the close channels. |
Accessibility
- The strip is a <nav> labelled "Window layers" with aria-live="polite": a layer joining or leaving is announced as a region update rather than silently changing under the user. Keep the stack shallow — a deep stack turns every open into a burst of re-announcement.
- The label is hikari::modal.stackLabel on the Vue side and components.hk.modalBreadcrumb.stackLabel on the Rust side — the same English literal under two key namespaces — so a translation added to one dictionary alone leaves the two forms speaking different languages.
- The measurement clone is aria-hidden="true", so a screen-reader user hears each layer once, not twice: the ruler is a full copy of every crumb at its natural width, and without the attribute it would double the strip in the accessibility tree.
- A truncated label is a <button> whose accessible name is the full layer name, not the cut string; an uncut label is plain text with no focus stop. A cut crumb is therefore reachable by keyboard, and activating it opens the reveal surface.
- The "…" trigger is a <button> with aria-label "All layers", aria-haspopup="dialog" and aria-expanded, so its state is announced before the menu appears; the menu itself is a role="menu" list of role="menuitem" rows with the current layer marked selected.
- Escaping the menu, the reveal or the sheet is the mirrored Popover's job on the Rust side; on the Vue side the strip listens for Escape while either surface is open.
Related components
- DockBar — the other piece of chrome that floats over a page edge; this one spans the top.
- HkModal — the window layer whose name a crumb carries.
- HkDrawer — the side layer that joins the stack exactly like a modal.
- HkPopover — owns the anchored-or-sheet form the menu and the reveal both use.