You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(sidebar): search the workspace switcher when a user has many workspaces
Shows a search input in the workspace dropdown once the list exceeds
WORKSPACE_SEARCH_THRESHOLD (3). ArrowUp/Down move through results, Enter
switches, and the query resets on close. All the search machinery is gated on
showSearch so users with few workspaces get no extra re-renders. The input
reuses the emcn ChipInput chrome (icon prop) rather than hand-rolling the field.
The highlight tracks the highlighted workspace by identity (a stored id, not a
numeric position), so a live list change while the menu is open — shrink, grow,
or reorder from a membership change or background refetch — keeps the highlight
and Enter on the same workspace; a filtered-out or absent selection falls back
to the first row. `activeIndex` derives from that id and is the single source of
truth for Enter, the visual highlight, and the scroll target.
Search and highlight reset via an effect keyed on the menu-open state, so closing
by any path (selecting a workspace, Escape, click-away) clears them — not only
the Radix-driven close that routes through onOpenChange. Hover-highlight is wired
to mousemove rather than mouseenter so a keyboard-driven scrollIntoView can't fire
a synthetic enter that hijacks the keyboard selection.
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workspace-header/workspace-header.tsx
0 commit comments