---
description: Hover/focus peek on collapsed icon rails (primary sidebar, secondary panel, drill-in) — desktop flyout without scrim
globs: "**/ui/sidebar.tsx,**/shell/secondary-panel.tsx,**/hooks/use-hover-peek.ts,**/sidebar-drill-in.tsx"
alwaysApply: false
appliesTo: [react]
---

# Exxat DS — collapsed rail hover peek (MUST)

A **collapsed icon rail** (primary `Sidebar collapsible="icon"`, compact `SecondaryPanel`, and the `SidebarDrillIn` section that lives inside the primary rail) **peeks open on hover or keyboard focus**: the full labelled panel floats over the content, like the mobile nav flyout **without the scrim**. Pattern doc: **`docs/exxat-ds/rail-hover-peek-pattern.md`**.

## MUST

1. **Use `useHoverPeek(enabled)`** (`packages/ui/src/hooks/use-hover-peek.ts`) — do not hand-roll hover timers. It owns open delay (120 ms), close grace (180 ms), touch exclusion, `:focus-visible` open, and Escape dismiss.
2. **Enabled only on the desktop icon rail** — `collapsible === "icon"`, rail actually collapsed, and **not** `isNavFlyout` (mobile / ≥200 % zoom keep the existing sheet + scrim).
3. **No scrim, no reflow** — the layout gap / panel width stays at icon width (`group-data-[peek=true]:w-(--sidebar-width-icon)`); the peek floats. Content underneath MUST NOT move.
4. **Children see "expanded"** — peek overrides `useSidebar().state` to `"expanded"` (primary) or `secondaryPanelCompact: false` (secondary) so the **real panel body** renders. MUST NOT render the icon strip at full width.
5. **Flush and square** — peek sheets are full-height, **no corner radius, no inset**, `shadow-[var(--shadow-sheet-flyout)]`. Same look for primary and secondary. (The *mobile* flyout keeps its inset rounded chrome — that is a different mode.)
6. **Layering** — primary peek MUST sit above the secondary rail (`!z-[50]`); secondary peek is `z-[45]`. Shell stacking uses `z-10` rails, so a plain `z-30` loses.
7. **Animate with `clip-path` only** — use the shared **`.rail-peek-reveal`** class (`@keyframes rail-peek-reveal` in `globals.css`, `--peek-from` = rail width). **MUST NOT** animate `width` / `left` on peek: it re-wraps nav text each frame and feels laggy. Fill mode is `backwards` (never `both`) so the shadow is not clipped after the reveal. `prefers-reduced-motion` = no animation.
8. **Close is instant** — no shrink animation (laggy and fights pointer travel).
9. **Secondary peek is `position: fixed`**, measured from the strip's `getBoundingClientRect()` on open, so `ResizablePanelGroup` overflow cannot clip it.

## MUST NOT

- Add an overlay / backdrop to the desktop peek.
- Open the peek on touch (`pointerType === "touch"`), or while the rail is expanded.
- Persist peek state, or let it change `open` / `secondaryPanelCompact` / cookies — it is purely visual.
- Fork a second copy of the nav DOM for the peek of the **primary** rail (duplicate focus targets). Reuse the one tree and restyle the container.

## Verify

1. Collapse the secondary panel (« button), hover the strip → full "Library" panel grows from the strip, shadow visible, content did not shift.
2. Hover the primary icon rail → full sidebar floats over the secondary rail; secondary did **not** move.
3. Tab into the rail with the keyboard → peek opens; Esc closes.
4. Resize < 768 px or zoom ≥ 200 % → old mobile sheet + scrim, no peek.

## See also

- **`.cursor/rules/exxat-primary-nav-secondary-panel.mdc`** — panel registry + auto-open.
- **`.cursor/rules/exxat-secondary-panel-vs-drill-in.mdc`** — which rail pattern.
- **`.cursor/rules/exxat-sidebar-shell.mdc`** — DS-only sidebar styling.
- **`.cursor/rules/exxat-accessibility.mdc`** — focus + reduced motion.
