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

Some menu components not supporting ctrl click to open new duplicate screen #10919

Closed
waratah opened this issue Dec 6, 2021 · 4 comments
Closed
Assignees
Labels
LTS-PORTABLE Issue's fix will be ported to supported LTS versions Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@waratah
Copy link
Contributor

waratah commented Dec 6, 2021

I'm submitting a ... (check one with "x")

[X ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior
Control click on a menu item does not open a new page with the menu item selected rendered.

Expected behavior
New tab opened with selected page showing.

Minimal reproduction of the problem with instructions

The issue is caused by prevent default being blocked when the router link is used and control key & click is pressed.

    onCategoryClick(event, item: MenuItem | MegaMenuItem) {
        if (item.disabled) {
            event.preventDefault();
            return;
        }

        if (!item.url) {
            event.preventDefault();
        }

        if (item.command) {
            item.command({
                originalEvent: event,
                item: item
            });
        }

Code change to stop hiding ctrl key being pressed:

        if (item.disabled) {
            event.preventDefault();
            return;
        }

        if (!item.url && !event.ctrlKey) {
            event.preventDefault();
        }

What is the motivation / use case for changing the behavior?

My clients use this to open new screens from menus a lot.

Please tell us about your environment:

Windows chrome users

  • Angular version: 5.X

Angular 12

  • PrimeNG version: 5.X

Prime 12

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

Chrome and firefox

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node (for AoT issues): node --version =

@waratah
Copy link
Contributor Author

waratah commented Dec 6, 2021

Same problem exists in menu as well.

@waratah
Copy link
Contributor Author

waratah commented Dec 7, 2021

Pull Request: #10929

@yigitfindikli yigitfindikli changed the title Mega menu not supporting ctrl click to open new duplicate screen Some menu components not supporting ctrl click to open new duplicate screen Dec 7, 2021
@yigitfindikli yigitfindikli self-assigned this Dec 7, 2021
@yigitfindikli yigitfindikli added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Dec 7, 2021
@yigitfindikli yigitfindikli added this to the 13.0.2 milestone Dec 7, 2021
@yigitfindikli yigitfindikli added the LTS-PORTABLE Issue's fix will be ported to supported LTS versions label Dec 7, 2021
@yigitfindikli
Copy link
Contributor

Hi @waratah,

Thanks for your investigation and PR.

Regards.

@waratah
Copy link
Contributor Author

waratah commented Dec 17, 2021

Please note that the line @ 149 is still missing so a menu item that it on the top bar does not have control click.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTS-PORTABLE Issue's fix will be ported to supported LTS versions Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants