Repository navigation
refactor(app): share the workspace submenu with the missing-location menu - #55665
Conversation
There was a problem hiding this comment.
The extraction looks right, and bun typecheck passes in packages/app. I couldn't run the app here (there's no browser), so I checked it by reading the code, including Kobalte's menu focus handling. Before/after screenshots or a short clip of the submenu with 10+ workspaces would help, especially arrow-key navigation through a long list.
Public API: unchanged. WorkspaceSubmenu is internal to packages/app.
One likely regression, explained inline: when the list overflows, arrow-key navigation probably no longer scrolls the focused workspace into view.
| /> | ||
| </div> | ||
| </Show> | ||
| <div ref={list} data-slot="workspace-submenu-list" class="min-h-0 overflow-y-auto overscroll-contain"> |
There was a problem hiding this comment.
This probably breaks keyboard scrolling for long lists. Kobalte moves focus between menu items with focusWithoutScrolling, then scrolls only the menu content element: scrollIntoView(ref, item) in createSelectableCollection, and MenuContentBase passes no separate scrollRef. Before this change, SubContent was overflow-y-auto, so that call scrolled it. Now SubContent is overflow-hidden and never overflows, because this inner div does the scrolling. Arrowing past the ~9 visible workspaces would move focus to items that stay out of view.
The native .focus() in the search field's ArrowUp/Down handler does scroll, but every arrow press after that wouldn't. Could you scroll this list into view when the focused item changes, for example with onFocusIn calling scrollIntoView({ block: "nearest" }) on the target?
Summary
Moves the new-session picker's "Existing workspace" submenu into a shared
WorkspaceSubmenucomponent (packages/app/src/workspaces/submenu.tsx) and uses it in the "Choose worktree" menu shown when a session's directory is missing.The move also changes some behavior:
disabledandonViewAllprops cover menus that block selection while busy or have no "View all" page.requestAnimationFramefocus. The submenu now sends that focus back to the search field until the pointer moves into the submenu or the user arrows out of the field. Opening it by hover still leaves focus alone.Missing-location "Choose worktree" menu
disabled={move.isPending}and no "View all". This adds search for 10+ worktrees, where the old menu was a flatmax-h-80list without search.outline-worktreeinstead ofworkspace-isolatedand no longer show a full-pathtitletooltip.Before / After
Desktop web, 1280×640, new-session draft with 14 worktrees.
Testing
packages/app:bun typecheckpackages/app:e2e/regression/session-location-sync.spec.tsande2e/regression/new-session.spec.ts(23 passed). The missing-location recovery test now opens the "Worktree" submenu first.