-
Notifications
You must be signed in to change notification settings - Fork 3
[ContextMenu] Add new context-menu component #631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| }, | ||
| control: { type: 'object' } | ||
| }, | ||
| skin: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heads up for other reviewers, most of the following arguments come directly from OSS::Button ; new arguments resume on line 155
| export default class OSSContextMenuComponent extends Component<OSSContextMenuArgs> { | ||
| @tracked displayContextMenuPanel: boolean = false; | ||
| @tracked declare referenceTarget: HTMLElement; | ||
| @tracked contextMenuPanels: HTMLElement[] = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: private ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on February 28
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| } | ||
|
|
||
| this.args.onMouseLeave?.(event); | ||
| this.clearSubMenu(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sub-menu closes when hovering to it in production
High Severity
The mouseLeave handler's check subPanelElement.contains(event.relatedTarget) fails in production because subPanelElement references the hidden wrapper div while the visible sub-panel content is portaled to document.body. When the mouse moves from the parent panel to the sub-panel, the check incorrectly fails and the newly added clearSubMenu() call closes the sub-menu. This works in tests because portalTarget is the wrapper element itself, making the containment check valid.


What does this PR do?
Related to: DRA-4462
What are the observable changes?
Enregistrement.de.l.ecran.2026-01-30.a.11.54.31.mov
The new ContextMenu component has been added. This component is a customizable button that displays panels. It handle properly placement & click outside behaviors.
Good PR checklist
Note
Medium Risk
Adds a new UI component and changes menu close semantics (click-outside, mouseleave, and item-action return values) which could affect existing context-menu consumers and nested submenu behavior.
Overview
Adds a new
OSS::ContextMenucomponent that wrapsOSS::Buttonand manages an anchoredOSS::ContextMenu::Panel, including open/close state, click-outside handling across nested panels, optional close-on-mouse-leave, andonMenuOpened/onMenuClosedcallbacks.Updates
OSS::ContextMenu::Panelto supportonCloseand panel registration hooks, closes the menu after item selection unless the item action returnsfalse, and improves submenu cleanup (including customrowRendererclicks). Styling is adjusted to hide the panel container outside tests, and Storybook + dummy app examples and new integration tests are added/updated accordingly.Written by Cursor Bugbot for commit b6021ce. This will update automatically on new commits. Configure here.