Skip to content

feat(sidebar): add right-click context menu to settings nav item#3715

Merged
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/settings-right-click-menu
Mar 23, 2026
Merged

feat(sidebar): add right-click context menu to settings nav item#3715
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/settings-right-click-menu

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add right-click context menu with "Open in new tab" and "Copy link" to Settings sidebar item
  • Settings now renders as a Link with href, enabling the same context menu as Knowledge Base, Tables, etc.
  • Settings nav item now highlights when on the settings page

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Mar 23, 2026 4:00pm

Request Review

@cursor
Copy link

cursor bot commented Mar 23, 2026

PR Summary

Low Risk
Low risk UI/navigation change limited to sidebar rendering and link handling; main risk is minor behavioral differences from preventing default navigation when onClick is present.

Overview
The Settings footer item in the workspace sidebar now renders as a real Link (using getSettingsHref()), enabling the existing right-click nav context menu actions like Open in new tab and Copy link.

SidebarNavItem was refactored to share common content between Link and button, and to optionally intercept Link clicks to run an onClick handler without navigation. The Settings item also now highlights as active when the current route is within /workspace/:id/settings.

Written by Cursor Bugbot for commit 6bb284f. Configure here.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 23, 2026

Greptile Summary

This PR converts the Settings sidebar nav item from a plain <button> to a Next.js <Link> with an explicit href, enabling the existing right-click context menu (Open in new tab / Copy link) and active-state highlighting already available to other nav items (Knowledge Base, Tables, Logs).

Key changes:

  • SidebarNavItem now renders as a <Link> when item.href is present, falling back to <button> for onClick-only items, or null if neither is set.
  • The Settings footerItem now includes href: getSettingsHref() (resolving to /workspace/{id}/settings/general).
  • The existing onClick behaviour (sidebar collapse + navigateToSettings() for sessionStorage return-URL) is preserved by calling e.preventDefault() inside the Link's onClick.
  • Active-state highlighting is correctly set when isOnSettingsPage is true.

One issue found:

  • The onClick handler unconditionally calls e.preventDefault(), which blocks Cmd/Ctrl+click from opening the Settings page in a new tab. A modifier-key guard should be added to allow those clicks to pass through to the browser's native new-tab behaviour.

Confidence Score: 4/5

  • Safe to merge after addressing the Cmd/Ctrl+click regression — right-click context menu and active highlighting work correctly.
  • The change is well-scoped and the core feature (right-click context menu + active highlighting for Settings) works correctly. The single identified issue — unconditional e.preventDefault() breaking modifier-key new-tab navigation — is a targeted one-line fix and does not break the primary user path.
  • apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx — specifically the onClick handler inside SidebarNavItem's Link branch (lines 214–221).

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx Settings nav item converted to a Link with href for context-menu support, active-state highlighting added, and onClick wiring preserved via e.preventDefault() — but modifier-key clicks (Cmd/Ctrl+click to open in new tab) are inadvertently blocked.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[SidebarNavItem receives item] --> B{item.href?}
    B -- Yes --> C[Render as Next.js Link]
    B -- No --> D{item.onClick?}
    D -- Yes --> E[Render as button]
    D -- No --> F[Render null]

    C --> G{User interaction}
    G -- Left-click --> H{item.onClick defined?}
    H -- Yes --> I[e.preventDefault called\nitem.onClick fires\nnavigateToSettings + collapse]
    H -- No --> J[Normal Link navigation]
    G -- Right-click --> K[onContextMenu fires\nNavItemContextMenu shown]
    K --> L[Open in new tab\nwindow.open href _blank]
    K --> M[Copy link\nnavigator.clipboard.writeText]
    G -- Cmd/Ctrl+click --> N[e.preventDefault also fires\nnew tab NOT opened ⚠️]
Loading

Reviews (1): Last reviewed commit: "feat(sidebar): add right-click context m..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit 91a0a49 into staging Mar 23, 2026
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/settings-right-click-menu branch March 23, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant