Repository navigation
[fix] Make sidebar rows and workflow picker items middle-clickable links - #5205
Conversation
Sidebar menu rows rendered their anchor only around the title text; the icon and row padding navigated through router.push, so middle-click and ctrl+click could not open them in a new tab. The workflow switcher dropdown had no anchors at all. - SidebarMenu: stretch each link's anchor over the whole row with an absolutely positioned ::before (rows are the positioned containers, popups get the same rules via popupClassName); keep the expand caret above the anchor and disabled rows inert; give collapsed title overlays their full width so the rail icons are covered too. - WorkflowPicker: wrap each item in a real <Link> to the same href the switch would push (shared via the new appSwitchHrefAtom); plain left clicks preventDefault and stay on the antd onClick path, modified clicks fall through to the native anchor. Claude-Session: https://claude.ai/code/session_016NT3qqbMYQ97xFqVpbtbL1
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe app-switch destination is centralized in a shared atom, workflow items now render native links with modifier-click support, and sidebar styling stretches link interaction across menu rows while preserving toggle and disabled-row behavior. ChangesWorkflow navigation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant WorkflowSwitcher
participant appSwitchHrefAtom
participant SidebarMenu
participant nextLink
participant routerAppNavigationAtom
WorkflowSwitcher->>appSwitchHrefAtom: read app-switch href
appSwitchHrefAtom-->>WorkflowSwitcher: return destination href
WorkflowSwitcher->>nextLink: render WorkflowIdentity as link
SidebarMenu->>nextLink: stretch link interaction across menu row
nextLink->>WorkflowSwitcher: receive normal or modifier click
WorkflowSwitcher->>routerAppNavigationAtom: trigger normal app navigation
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Context
Middle-clicking (or ctrl+clicking) items in the sidebar did nothing for most of the clickable surface. Sidebar rows rendered a real anchor only around the title text; the icon and the rest of the row navigated through
router.pushin JavaScript, which the browser cannot open in a new tab. The workflow switcher dropdown (the agents list at the top of the sidebar) had no anchors at all, so none of its items could be opened in a new tab.Changes
Sidebar menu rows (
SidebarMenu.tsx): each link's anchor now stretches over the whole row with an absolutely positioned::before, so the icon, the padding, and the text are all part of one real link. Rows (.ant-menu-item,.ant-menu-submenu-title) become the positioned containers. Submenu popups render in a portal, so they get the same positioning rules throughpopupClassName. Two guards keep behavior identical:z-[1]), so it still toggles the group without navigatingpointer-events: none, so disabled items stay inertIn collapsed mode the invisible title overlay that covers each rail icon computed to width 0, so even the old text anchor never covered the icon. It now gets
w-full, which makes the rail icons middle-clickable too.Workflow picker (
useWorkflowSwitcher.tsx): every dropdown item is now wrapped in a real<Link>. The href is the same URL a click would push, built by the newappSwitchHrefAtom(extracted fromrouterAppNavigationAtominfetcher.tsso both share one URL source of truth, including the keep-current-subpage behavior). Plain left clickspreventDefault()and stay on the existing antdonClickpath; modified clicks (middle, ctrl, cmd, shift) fall through to the native anchor.Scope / risk
Only the sidebar menu engine and the workflow picker are touched. Other JS-navigated surfaces (the projects and orgs lists in the sidebar header, table rows) are unchanged and still not middle-clickable. The stretched-anchor pattern covers the full row, so any future row content that needs its own click handler must be positioned above the anchor like the caret.
Tests / notes
pnpm lint-fixclean;tscshows no new errors in the touched files (remaining errors are pre-existing in Playwright test helpers).How to QA
Prerequisites: any running stack (the Hetzner dev box at the live port works). Log in and open a project.
Steps:
Expected result: every middle-click opens the target page in a new background tab. Every left-click navigates in place exactly as before (no full page reload, dropdown closes after switching, caret only toggles the group).
Automated tests: none; this is CSS/anchor wiring with no unit-testable logic. Coverage is the manual matrix above.
Edge cases: disabled items (cloud-only features in OSS) must stay unclickable. The expand caret must never navigate.
https://claude.ai/code/session_016NT3qqbMYQ97xFqVpbtbL1