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

Menu: click on menu item with url does nothing #5785

Closed
arnodemer opened this issue Jan 17, 2024 · 8 comments · Fixed by #5792 or #5793
Closed

Menu: click on menu item with url does nothing #5785

arnodemer opened this issue Jan 17, 2024 · 8 comments · Fixed by #5792 or #5793
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@arnodemer
Copy link
Contributor

Describe the bug

CLick on menu item using .url doesn't works , it does nothing.

Reproducer

No response

PrimeReact version

10.3.1

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

Chrome, Opera, ...

Steps to reproduce the behavior

  1. go to: URL menu showcase: https://primereact.org/menu/#router
  2. click on "Router Link" -> nothing happens
  3. click on "External" -> nothing happens
  4. click on "Programmatic' -> you are redirected .

Expected behavior

Click on MenuItem using .url field should redirect to url contents.

@arnodemer arnodemer added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 17, 2024
@arnodemer
Copy link
Contributor Author

Menu.js
preventDefault() at line 91 is suspicious versus conditional one at line 72.

@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 Jan 17, 2024
@melloware melloware self-assigned this Jan 17, 2024
@melloware melloware added this to the 10.3.2 milestone Jan 17, 2024
@gucal gucal modified the milestones: 10.3.2, 10.4.0 Jan 17, 2024
melloware added a commit to melloware/primereact that referenced this issue Jan 17, 2024
melloware added a commit that referenced this issue Jan 17, 2024
@gucal gucal modified the milestones: 10.4.0, 10.3.2 Jan 17, 2024
@arnodemer
Copy link
Contributor Author

PR #5792 will change 10.3.1 behavior because we are using some MenuItem having both .url and .command.
previously: menu item command() is ran (doing validation calling preventDefault() if required ...)
with PR: menu item command() is no more ran, (url -> using only url).
This introduce higher priority on .url versus .command(), then at least documentation should be clear on this point.
(in addition MenuItem documentation miss 'command' attribute)

@melloware
Copy link
Member

@arnodemer when they refactored for accessibility the <a> element with your href on it is now a hidden element inside the <div> If you stop propagation it won't allow the <a> to be clicked.

You want a command and a url both executed?

melloware added a commit to melloware/primereact that referenced this issue Jan 17, 2024
melloware added a commit that referenced this issue Jan 17, 2024
@melloware
Copy link
Member

OK submitted a better fix to allow URL and COMMAND handling. #5793

@melloware
Copy link
Member

@arnodemer 10.3.2 is on NPMJS if you want to give it a shot and let me know.

@arnodemer
Copy link
Contributor Author

@melloware thanks for fixing it again.
Even if MenuItem use <a aria-hidden="true"../>, browser display the URL, this help user to understand where menu item will go.
I prefer that command() is ran even if a .url is set on MenuItem.
I'll don't know when I can upgrade to 10.3.2 but will do.

@arnodemer
Copy link
Contributor Author

Hi @melloware , I have upgraded to 10.3.2, menu item fix is nice,
thanks a lot

@melloware
Copy link
Member

Thanks for reporting and confirming!

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
3 participants