primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Menubar with autoDisplay doesn't close submenu on mouseout

Open Urtgard opened this issue 3 years ago • 8 comments

[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

Plunkr Case (Bug Reports) https://stackblitz.com/edit/primeng-menubar-demo-nfau6b?file=src%2Fapp%2Fapp.component.html

Current behavior When the cursor leaves a menuitem the submenu stays open and the css-class p-menuitem-active won't be removed.

Expected behavior Submenus shold be closed and p-menuitem-active should be removed.

  • Angular version: 12.0.5

  • PrimeNG version: 12.2.0

  • Browser: Chrome 94


If you disagree and think this is working as intended, please add an option to choose how the menubar should handle on mouseout.

Urtgard avatar Oct 08 '21 18:10 Urtgard

Hi @Urtgard,

Menu components close when clicking events by design. So it's not a bug. I'm gonna mark it as a discussion. Let's hear the community.

yigitfindikli avatar Oct 13 '21 08:10 yigitfindikli

Agree with @Urtgard. It's strange that the active class remains while the cursor is not over the menuitem anymore. The same could be said about the submenu staying open.

The way I expect to see it is autoDisplay on true is hover-based, while on false it's click-based.

daangeerdink avatar Nov 16 '21 10:11 daangeerdink

I agree with @daangeerdink. There are no words to add, he described it well.

sutux avatar Aug 05 '22 16:08 sutux

Yes, please change this, it should at least be an option.

johnfewell avatar Aug 15 '22 20:08 johnfewell

Hi,

So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap? Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!

Best Regards,

mertsincan avatar Nov 09 '22 20:11 mertsincan

Hi,

unfortunately, this is still an issue. I tried it on Stackblitz with PrimeNG Version 14.2.1: https://stackblitz.com/edit/primeng-menubar-demo-cv9w8m?file=src/app/app.component.html

sutux avatar Nov 09 '22 21:11 sutux

using this as a workaround

<p-tieredMenu #tieredMenu [model]="menuItems" [autoDisplay]="true" (mouseleave)="onMouseleave()"></p-tieredMenu>
  onMouseleave(){
    window.document.body.click();
  }

pete-mcwilliams avatar Feb 15 '23 10:02 pete-mcwilliams

using this as a workaround

<p-tieredMenu #tieredMenu [model]="menuItems" [autoDisplay]="true" (mouseleave)="onMouseleave()"></p-tieredMenu>
  onMouseleave(){
    window.document.body.click();
  }

this is perfectly working, thanks!

but... shouldn't autoHide property be doing the same thing? that's not working on Angular 17 for me

fabiosalat avatar Feb 10 '24 11:02 fabiosalat

I was also expecting [autoHide]="true" to achieve this, but it doesn't seem to work in v16.9.1.

vpeter1119 avatar Mar 13 '24 20:03 vpeter1119