Skip to content
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

ContextMenu: Broken with nested items (10.0) #5064

Closed
gnawjaren opened this issue Oct 9, 2023 · 2 comments · Fixed by #5067
Closed

ContextMenu: Broken with nested items (10.0) #5064

gnawjaren opened this issue Oct 9, 2023 · 2 comments · Fixed by #5067
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@gnawjaren
Copy link
Contributor

Describe the bug

ContextMenu is broken in 10.0 upwards, when used with nested menu items. It happens on the demo page too, on the second example (https://primereact.org/contextmenu/#document).
(submenuIconClassName is not defined)

It seems to be a very easy fix, I can provide a PR if wanted. But it really is a one line fix.
The submenuIconClassName variable was removed at some point. (8118900#diff-c1256c61f2cca219b7a6963af2945a698e1ae969414f76ec846a7d5d7a35683fL132)
And not removed at one other place. Patch to fix below.

index fa60a2193..dad756388 100644
--- a/components/lib/contextmenu/ContextMenuSub.js
+++ b/components/lib/contextmenu/ContextMenuSub.js
@@ -187,7 +187,7 @@ export const ContextMenuSub = React.memo((props) => {
                 className: 'p-menuitem-link',
                 labelClassName: 'p-menuitem-text',
                 iconClassName: 'p-menuitem-icon',
-                submenuIconClassName,
+                submenuIconClassName: cx('submenuIcon'),
                 element: content,
                 props,
                 active

changes.patch

Thanks for the great work!

Reproducer

https://primereact.org/contextmenu/#document

PrimeReact version

10.0.2

React version

17.x

Language

ALL

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Open demo Page
  2. Go to "Document"
  3. right click

Expected behavior

Expected to show ContextMenu and not to produce an error

@gnawjaren gnawjaren added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Oct 9, 2023
@melloware
Copy link
Member

Sure provide a PR would be great!

@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Oct 9, 2023
@melloware melloware added this to the 10.0.3 milestone Oct 9, 2023
gnawjaren added a commit to gnawjaren/primereact that referenced this issue Oct 9, 2023
@melloware
Copy link
Member

Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants