Skip to content

[WEB-5068] fix: CustomMenu closeOnSelect behavior#7897

Merged
pushya22 merged 1 commit intopreviewfrom
fix-custom-menu-close-on-select
Oct 7, 2025
Merged

[WEB-5068] fix: CustomMenu closeOnSelect behavior#7897
pushya22 merged 1 commit intopreviewfrom
fix-custom-menu-close-on-select

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Oct 3, 2025

Description

Fixed CustomMenu.MenuItem onClick handlers by removinge.preventDefault() and e.stopPropagation() calls that were preventing the closeOnSelect prop from functioning correctly.

Type of Change

  • Bug fix
  • Code refactoring

Summary by CodeRabbit

  • Refactor

    • Simplified click handling across quick-action and context menus, removing unnecessary event suppression for more consistent behavior.
    • Unified handlers across issues, cycles, modules, projects, views, and workspace settings for predictable action execution and tracking.
    • Improved interaction with nested menus and surrounding links by relying on default event flow.
  • Bug Fixes

    • Reduced cases where menu actions felt unresponsive or modals failed to open due to blocked events, improving reliability of quick actions and link/attachment operations.

@anmolsinghbhatia anmolsinghbhatia self-assigned this Oct 3, 2025
Copilot AI review requested due to automatic review settings October 3, 2025 07:14
@anmolsinghbhatia anmolsinghbhatia marked this pull request as draft October 3, 2025 07:14
@makeplane
Copy link

makeplane bot commented Oct 3, 2025

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Replaced onClick handlers across multiple React components to remove explicit event.preventDefault() and stopPropagation() calls. Handlers now invoke actions directly (often with captureClick first). No exported API changes, except localized handler signature simplifications where noted.

Changes

Cohort / File(s) Summary of changes
Quick Actions (Cycles/Modules/Views)
apps/web/core/components/cycles/quick-actions.tsx, apps/web/core/components/modules/quick-actions.tsx, apps/web/core/components/views/quick-actions.tsx
Simplified onClick handlers to omit event param; retain captureClick then execute item.action().
Issue Quick-Action Dropdowns
.../issues/issue-layouts/quick-action-dropdowns/all-issue.tsx, .../archived-issue.tsx, .../cycle-issue.tsx, .../issue-detail.tsx, .../module-issue.tsx, .../project-issue.tsx
Removed e.preventDefault()/stopPropagation(); handlers now directly capture click (where present) and trigger actions for both top-level and nested items.
Issue Detail Widgets (Relations/Sub-issues)
.../issues/issue-detail-widgets/relations/quick-action-button.tsx, .../issues/issue-detail-widgets/sub-issues/quick-action-button.tsx, .../issues/issue-detail-widgets/sub-issues/issues-list/list-item.tsx
Converted menu item onClick from event-aware to simple callbacks; direct calls to handler functions without preventing default/propagation.
Issue Attachments and Links
.../issues/attachment/attachment-list-item.tsx, .../issues/issue-detail/links/link-item.tsx
Replaced event-based onClick with direct calls (toggle modal, remove link) without preventDefault/stopPropagation.
Workspace Views (Quick Actions & Items)
.../workspace/views/quick-action.tsx, .../workspace/views/view-list-item.tsx, .../workspace/views/default-view-quick-action.tsx
Removed event suppression in onClick; now directly log/capture (where applicable) then invoke actions or open modals.
Workspace Settings
.../workspace/settings/invitations-list-item.tsx
Simplified onClick to call item.action() directly; removed event handling.
Pages Dropdowns
.../pages/dropdowns/actions.tsx
onClick updated from (e) => ... to () => ...; removed preventDefault/stopPropagation, optionally calls item.action?.().

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant M as CustomMenu.MenuItem
  participant T as Tracker (captureClick)
  participant A as Action

  rect rgb(240,248,255)
  note over M: Before
  U->>M: click
  M->>M: preventDefault() / stopPropagation()
  M->>T: captureClick(...)
  M->>A: item.action()
  end

  rect rgb(245,255,240)
  note over M: After
  U->>M: click
  M->>T: captureClick(...) (when present)
  M->>A: item.action()
  note over U,M: Default event flow proceeds (no explicit suppression)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Suggested labels

🐛bug, 🌐frontend

Suggested reviewers

  • vamsikrishnamathala
  • sriramveeraghanta

Poem

I clicked without a fuss—no stops, no fray,
Events now hop along their merry way.
A nibble of action, a tracker’s wink,
Quick menus pop—blink, blink!
Hare today, gone delay—ship it, I say! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The description and type of change sections are filled out correctly, but the PR omits the “Test Scenarios” section and lacks any entries under “Screenshots and Media” or “References,” which are required by the repository template to fully document and verify the changes. Please add the missing “Test Scenarios” section with details of how you tested the fix and include any relevant screenshots, media, or references to related issues to fully conform to the template.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title “[WEB-5068] fix: CustomMenu closeOnSelect behavior” clearly summarizes the primary change by specifying the component and behavior being fixed without any unnecessary detail or vague wording.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-custom-menu-close-on-select

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Fixed CustomMenu.MenuItem onClick handlers by removing preventDefault() and stopPropagation() calls that were preventing the closeOnSelect prop from functioning correctly.

  • Removed event.preventDefault() and event.stopPropagation() calls from CustomMenu.MenuItem onClick handlers
  • Simplified onClick handlers to use arrow functions without event parameters where the event object is not needed
  • Applied the fix consistently across multiple components that use CustomMenu.MenuItem

Reviewed Changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated no comments.

Show a summary per file
File Description
view-list-item.tsx Removed event handling calls from two CustomMenu.MenuItem onClick handlers
quick-action.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler
default-view-quick-action.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler
invitations-list-item.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler
views/quick-actions.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler
pages/dropdowns/actions.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler
modules/quick-actions.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler
workspace-draft/quick-action.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler
project-issue.tsx Removed event handling calls from multiple CustomMenu.MenuItem onClick handlers
module-issue.tsx Removed event handling calls from multiple CustomMenu.MenuItem onClick handlers
issue-detail.tsx Removed event handling calls from multiple CustomMenu.MenuItem onClick handlers
cycle-issue.tsx Removed event handling calls from multiple CustomMenu.MenuItem onClick handlers
archived-issue.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler
all-issue.tsx Removed event handling calls from multiple CustomMenu.MenuItem onClick handlers
link-item.tsx Removed event handling calls from two CustomMenu.MenuItem onClick handlers
quick-action-button.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler
list-item.tsx Removed event handling calls from multiple CustomMenu.MenuItem onClick handlers
relations/quick-action-button.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler
attachment-list-item.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler
cycles/quick-actions.tsx Removed event handling calls from CustomMenu.MenuItem onClick handler

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx (1)

97-100: Tracking order inconsistent with other files.

The action is invoked before captureClick(), whereas other files in this PR (e.g., issue-detail.tsx lines 280-281, all-issue.tsx lines 179-180) call captureClick() first, then the action. While this doesn't break functionality, consistent ordering helps with tracking accuracy.

Apply this diff for consistency:

 onClick={() => {
-  item.action();
   captureClick({ elementName: WORK_ITEM_TRACKER_ELEMENTS.QUICK_ACTIONS.ARCHIVED });
+  item.action();
 }}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 794271a and 0a1d7cc.

📒 Files selected for processing (20)
  • apps/web/core/components/cycles/quick-actions.tsx (1 hunks)
  • apps/web/core/components/issues/attachment/attachment-list-item.tsx (1 hunks)
  • apps/web/core/components/issues/issue-detail-widgets/relations/quick-action-button.tsx (1 hunks)
  • apps/web/core/components/issues/issue-detail-widgets/sub-issues/issues-list/list-item.tsx (4 hunks)
  • apps/web/core/components/issues/issue-detail-widgets/sub-issues/quick-action-button.tsx (1 hunks)
  • apps/web/core/components/issues/issue-detail/links/link-item.tsx (2 hunks)
  • apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx (2 hunks)
  • apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/archived-issue.tsx (1 hunks)
  • apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx (2 hunks)
  • apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/issue-detail.tsx (2 hunks)
  • apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx (2 hunks)
  • apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx (2 hunks)
  • apps/web/core/components/issues/workspace-draft/quick-action.tsx (1 hunks)
  • apps/web/core/components/modules/quick-actions.tsx (1 hunks)
  • apps/web/core/components/pages/dropdowns/actions.tsx (1 hunks)
  • apps/web/core/components/views/quick-actions.tsx (1 hunks)
  • apps/web/core/components/workspace/settings/invitations-list-item.tsx (1 hunks)
  • apps/web/core/components/workspace/views/default-view-quick-action.tsx (1 hunks)
  • apps/web/core/components/workspace/views/quick-action.tsx (1 hunks)
  • apps/web/core/components/workspace/views/view-list-item.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Build and lint web apps
🔇 Additional comments (26)
apps/web/core/components/issues/workspace-draft/quick-action.tsx (1)

34-36: LGTM! Clean removal of event control.

The onClick handler correctly removes preventDefault and stopPropagation, allowing the closeOnSelect prop to function as intended while still executing the item action.

apps/web/core/components/modules/quick-actions.tsx (1)

200-205: LGTM! Event flow correctly restored.

The handler now allows the menu's closeOnSelect behavior to work while preserving click tracking and action invocation.

apps/web/core/components/views/quick-actions.tsx (1)

98-101: LGTM! Consistent with PR objective.

The simplified onClick handler enables the closeOnSelect functionality while maintaining click analytics.

apps/web/core/components/cycles/quick-actions.tsx (1)

226-231: LGTM! Pattern correctly applied.

The refactored handler allows menu closure on selection while preserving event tracking.

apps/web/core/components/issues/attachment/attachment-list-item.tsx (1)

86-88: LGTM! Simplified correctly.

The handler now allows the menu to close on selection after invoking the delete modal.

apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx (2)

194-197: LGTM! Nested menu handler fixed.

The submenu item onClick correctly allows menu closure while tracking clicks and executing actions.


230-233: LGTM! Regular menu handler fixed.

The top-level menu item onClick now enables proper closeOnSelect behavior.

apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx (2)

195-198: LGTM! Submenu handler corrected.

The nested menu item now allows the menu to close on selection as expected.


231-234: LGTM! Top-level handler corrected.

The regular menu item onClick enables proper closure behavior.

apps/web/core/components/issues/issue-detail-widgets/sub-issues/quick-action-button.tsx (1)

89-91: LGTM! Handler correctly simplified.

The onClick now allows the closeOnSelect prop to function properly while invoking the item's action.

apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/issue-detail.tsx (1)

279-282: LGTM! Event handling correctly simplified.

The onClick handlers now directly invoke actions without suppressing event propagation, which allows the closeOnSelect prop (line 242) to function correctly. The tracking call is preserved and executed before the action in both nested and regular menu items.

Also applies to: 315-318

apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx (1)

178-181: LGTM! Consistent refactor for closeOnSelect.

The onClick handlers are correctly simplified to allow event propagation, enabling the closeOnSelect prop (line 141) to work as intended. The tracking logic remains intact.

Also applies to: 214-217

apps/web/core/components/workspace/views/view-list-item.tsx (1)

54-59: Verify Link navigation behavior.

The onClick handlers no longer prevent default behavior. Since these menu items are rendered within a Link component (line 41), clicks will now propagate and potentially trigger navigation to the link's href while opening the modal. This differs from the previous behavior where preventDefault() would have blocked navigation.

Verify that this is the intended behavior. If menu actions should not trigger navigation, consider one of these approaches:

onClick={(e) => {
  e.preventDefault();
  captureClick({ elementName: GLOBAL_VIEW_TRACKER_ELEMENTS.LIST_ITEM });
  setUpdateViewModal(true);
}}

Or restructure the component so the CustomMenu is outside the Link wrapper.

Also applies to: 67-72

apps/web/core/components/workspace/settings/invitations-list-item.tsx (1)

188-190: LGTM! Handler simplified correctly.

The onClick handler directly invokes the action, allowing the closeOnSelect prop (line 182) to function properly. The tracking logic is embedded in the action definitions (e.g., line 99-102), so the refactor maintains the intended behavior.

apps/web/core/components/workspace/views/default-view-quick-action.tsx (1)

64-66: LGTM! Simplified handler enables closeOnSelect.

The onClick handler correctly invokes the action without event suppression, allowing the closeOnSelect prop (line 56) to work as intended.

apps/web/core/components/issues/issue-detail-widgets/relations/quick-action-button.tsx (1)

53-55: LGTM! Handler correctly refactored.

The onClick handler now directly invokes handleOnClick() without event suppression, enabling the closeOnSelect prop (line 45) to function correctly.

apps/web/core/components/pages/dropdowns/actions.tsx (1)

220-222: LGTM! Handler with safe optional chaining.

The onClick handler correctly uses optional chaining to invoke the action, allowing the closeOnSelect prop (line 214) to function properly. The tracking logic is embedded in the action definitions (e.g., lines 98-101).

apps/web/core/components/issues/issue-detail-widgets/sub-issues/issues-list/list-item.tsx (4)

188-191: LGTM!

The onClick handler correctly invokes the edit action directly without event interference, allowing the CustomMenu's closeOnSelect behavior to function properly.


201-203: LGTM!

The onClick handler correctly invokes the copy link action directly, allowing the CustomMenu's closeOnSelect behavior to function properly.


213-216: LGTM!

The onClick handler correctly invokes the remove action directly while preserving the project_id guard, allowing the CustomMenu's closeOnSelect behavior to function properly.


229-232: LGTM!

The onClick handler correctly invokes the delete action directly without event interference, allowing the CustomMenu's closeOnSelect behavior to function properly.

apps/web/core/components/issues/issue-detail/links/link-item.tsx (2)

98-100: LGTM!

The onClick handler correctly invokes the edit action directly without event interference, allowing the CustomMenu's closeOnSelect behavior to function properly.


107-109: LGTM!

The onClick handler correctly invokes the delete action directly, allowing the CustomMenu's closeOnSelect behavior to function properly.

apps/web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx (2)

195-198: LGTM!

The onClick handler correctly invokes the analytics tracking followed by the nested item action, without event interference, allowing the CustomMenu's closeOnSelect behavior to function properly.


231-234: LGTM!

The onClick handler correctly invokes the analytics tracking followed by the item action, without event interference, allowing the CustomMenu's closeOnSelect behavior to function properly.

apps/web/core/components/workspace/views/quick-action.tsx (1)

74-79: LGTM!

The onClick handler correctly invokes the analytics tracking followed by the item action, without event interference, allowing the CustomMenu's closeOnSelect behavior to function properly.

@anmolsinghbhatia anmolsinghbhatia marked this pull request as ready for review October 5, 2025 13:13
@pushya22 pushya22 merged commit 3e82984 into preview Oct 7, 2025
8 checks passed
@pushya22 pushya22 deleted the fix-custom-menu-close-on-select branch October 7, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants