Skip to content

fix(sidebar): keep the right-click context menu open over the collapsed chat flyout - #6665

Merged
waleedlatif1 merged 4 commits into
stagingfrom
fix/chat-context-menu-hover
Aug 13, 2026
Merged

fix(sidebar): keep the right-click context menu open over the collapsed chat flyout#6665
waleedlatif1 merged 4 commits into
stagingfrom
fix/chat-context-menu-hover

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Right-clicking a chat row in the collapsed sidebar's flyout opened the context menu, but it vanished as soon as the mouse moved, so its items were unreachable. Clicking the three-dots worked, which is why it looked intermittent.
  • Cause: the flyout is itself a Radix menu. Radix menu rows call focus() on pointermove, and a menu refocuses its own content when the pointer leaves a row — so the first mouse movement after the right-click pulled focus back into the flyout. A non-modal Radix menu dismisses on focus-outside, so the context menu closed before the cursor reached it. The three-dots path escapes this because the action button is rendered as a sibling of the menu row, not inside it, so no row ever takes focus.
  • Fix: the context menu's onFocusOutside now ignores focus that lands in a surrounding menu. Every other dismissal path is unchanged — pointer-down outside, Escape, tabbing away to a non-menu element, and selecting an item all still close it.

Type of Change

  • Bug fix

Testing

  • Added regression tests: focus taken by a surrounding menu keeps the menu open; focus leaving to a plain element closes it; a press outside closes it. Verified they fail with the guard removed.
  • bun run type-check and bun run lint clean.

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

vercel Bot commented Aug 13, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 13, 2026 6:50pm

Request Review

@cursor

cursor Bot commented Aug 13, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Localized Radix menu focus/dismissal behavior in the sidebar with regression tests; no security, data, or API changes.

Overview
Fixes right-click context menus on chat rows in the collapsed sidebar flyout closing as soon as the mouse moves. The flyout is a non-modal Radix menu; pointer movement refocuses flyout rows, which triggered focus-outside dismissal on the overlay context menu before the cursor could reach it.

The shared ContextMenu now onFocusOutside prevents default when focus lands inside any [role="menu"], so focus bouncing back to the flyout does not dismiss it. Tabbing away, Escape, outside clicks, and choosing an item still close the menu as before.

For workflow rows in the same flyout, right-click opens the three-dots actions submenu with the cursor still on the row; Radix row pointermove / pointerleave focus behavior would close that submenu immediately. CollapsedWorkflowFlyoutItem applies holdRowFocus (mouse preventDefault) on those handlers only while its actions submenu is open.

New context-menu.test.tsx regression tests cover dismissal when a surrounding menu steals focus vs. focus leaving to a non-menu element and pointer-down outside.

Reviewed by Cursor Bugbot for commit 0494383. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR keeps sidebar context actions usable when nested Radix menus move focus and adds regression coverage for the intended dismissal behavior.

  • Preserves focus while moving from a collapsed-sidebar row into its actions submenu.
  • Ignores focus-outside events that return focus to a surrounding menu.
  • Tests menu retention, item actions, ordinary focus-outside dismissal, and pointer-outside dismissal.
  • Replaces the previously flagged relative component import with the established absolute alias.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains, and the previously reported relative-import issue is fixed at the current head.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/collapsed-sidebar-menu/collapsed-sidebar-menu.tsx Suppresses Radix row focus movement while the row’s actions submenu is open.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/context-menu/context-menu.tsx Keeps the context menu open when focus returns to a surrounding menu while preserving other dismissal paths.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/workflow-list/components/context-menu/context-menu.test.tsx Adds regression coverage and correctly fixes the previously reported relative component import.

Reviews (4): Last reviewed commit: "fix(sidebar): keep the collapsed workflo..." | Re-trigger Greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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

Reviewed by Cursor Bugbot for commit 83c641d. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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

Reviewed by Cursor Bugbot for commit 0494383. Configure here.

@waleedlatif1
waleedlatif1 merged commit 9c7b243 into staging Aug 13, 2026
24 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/chat-context-menu-hover branch August 13, 2026 19:00
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