Skip to content

fix(sidebar): cmd+click opens in new tab, shift+click for range select#3846

Merged
waleedlatif1 merged 3 commits intostagingfrom
fix/sidebar
Mar 30, 2026
Merged

fix(sidebar): cmd+click opens in new tab, shift+click for range select#3846
waleedlatif1 merged 3 commits intostagingfrom
fix/sidebar

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Fix cmd/ctrl+click on workflow and task sidebar items to open in a new tab instead of triggering selection (was calling e.preventDefault() for all modifier clicks)
  • shift+click still does range selection as expected
  • Remove dead noop callback

Type of Change

  • Bug fix

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)

@cursor
Copy link
Copy Markdown

cursor bot commented Mar 30, 2026

PR Summary

Low Risk
Low risk UI interaction change limited to sidebar click handlers; main risk is subtle regression in multi-selection behavior (toggle vs range) for tasks/workflows on shift-click.

Overview
Fixes sidebar link modifier-click behavior so cmd/ctrl+click is no longer intercepted by selection logic, allowing the browser to open tasks/workflows in a new tab.

Selection handlers for tasks and workflows are simplified to shift-click range/toggle only (removing metaKey parameters), and a dead noop callback is removed.

Written by Cursor Bugbot for commit 4cf1933. Configure here.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 30, 2026 5:51pm

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 30, 2026

Greptile Summary

This PR fixes a long-standing UX bug where cmd/ctrl+click on workflow and task sidebar items was incorrectly calling e.preventDefault(), blocking the browser's native "open in new tab" behaviour. The fix is well-scoped: the click handlers now return early (without e.preventDefault()) for modifier-key clicks, letting the underlying <Link> anchor handle the event natively, while shift+click still calls e.preventDefault() to prevent navigation and trigger range selection.

  • workflow-item.tsx: Replaced the combined isModifierClick guard with two separate checks — early return for metaKey/ctrlKey, e.preventDefault() only for shiftKey.
  • sidebar.tsx (SidebarTaskItem): Applied the same two-check pattern; onMultiSelectClick prop type updated to drop metaKey.
  • use-workflow-selection.ts / use-task-selection.ts: Removed the now-dead metaKey parameter and unreachable toggleSelection branches (follow-up from previous review feedback). Doc comments updated accordingly.
  • sidebar.tsx: Removed the unused noop callback.

Confidence Score: 5/5

Safe to merge — the fix is minimal, correctly scoped, and all prior review feedback has been addressed.

No P0 or P1 issues found. The browser-default-open-in-new-tab path works correctly because the handlers return early without calling preventDefault on the Link's anchor element. Shift-click range selection is unaffected. Dead code (metaKey branches, noop) has been cleanly removed.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/workflow-item/workflow-item.tsx Click handler now returns early (without preventDefault) for cmd/ctrl+click so the browser opens the Link in a new tab; shift+click still calls preventDefault for range selection. metaKey parameter removed from onWorkflowClick signature.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-workflow-selection.ts Dead metaKey parameter and unreachable toggleWorkflowSelection branch removed; doc comment updated to clarify cmd/ctrl+click is handled at browser level.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/hooks/use-task-selection.ts Dead metaKey parameter and unreachable toggleTaskSelection branch removed; doc comment updated to match.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx SidebarTaskItem onClick mirrors the workflow-item fix; onMultiSelectClick prop type updated; unused noop callback removed.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[User clicks sidebar item] --> B{modifier key pressed?}
    B -- cmd or ctrl --> C[Return early, browser opens new tab]
    B -- shift --> E[preventDefault, trigger range selection]
    B -- none --> G[Normal navigation, clear store selection]
Loading

Reviews (2): Last reviewed commit: "fix(sidebar): drop stale metaKey param f..." | Re-trigger Greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1
Copy link
Copy Markdown
Collaborator Author

@cursor review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1 waleedlatif1 merged commit 35b3646 into staging Mar 30, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/sidebar branch March 30, 2026 18:02
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