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/TieredMenu: First Element focussed when opening by button trigger #13818

Closed
skappler opened this issue Oct 6, 2023 · 16 comments · Fixed by #14998
Closed

Menu/TieredMenu: First Element focussed when opening by button trigger #13818

skappler opened this issue Oct 6, 2023 · 16 comments · Fixed by #14998
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@skappler
Copy link

skappler commented Oct 6, 2023

Describe the bug

When opening a Menu or TieredMenu, the first menu entry automatically has the p-focused class with the corresponding styling.

Screenshot 2023-10-06 at 14 38 37

Environment

Angular 16 app. Can also be reproduced on the demo page of primeng

Reproducer

No response

Angular version

16.2.8

PrimeNG version

16.3.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

16.20.1

Browser(s)

Chrome 117, Firefox 118

Steps to reproduce the behavior

  1. Go to https://primeng.org/tieredmenu
  2. Click the Show button in the popup section
  3. Observe the first entry being highlighted

Expected behavior

The first entry should not be highlighted

@skappler skappler 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 6, 2023
@scurk1415
Copy link

Would be nice to have this fixed

@bootsie123
Copy link

I'm running into this with the menu component on PrimeNG 17.0.0-beta.1. A fix would also be greatly appreciated. Thanks!

@Halynsky
Copy link

So small issue, but it's really confusing the users. Any updates?

@skappler
Copy link
Author

Ich looked at the primeng codebase and found some code that specifically enables this behaviour, so I assume this might be a feature not a bug. However, I don't really understand it from a UI perspective, so maybe someone from the team can at least explain it?

@jermylucas
Copy link
Contributor

@skappler @Halynsky This bug should have been fixed in the 17 rc. If you can give that a try and check. It's no longer happening on the primeng.org site either

@skappler
Copy link
Author

Can't confirm this. For me it's still happening on the primeng.org site when selecting version 17.1.0

@Halynsky
Copy link

@jermylucas Thx for response and for the try, but unfortunately it not work on priming.org with selected 17.3.0 (latest) version. Are you sure that it's already used on the priming.org? Is this fix released in the 17.3.0? Maybe now we can try to check it in the apps?

image

@STotev
Copy link

STotev commented Jan 25, 2024

I can confirm it's still an issue in 17.3.3.

@STotev
Copy link

STotev commented Jan 25, 2024

Just wanted to mention that this part of the code doesn't seem right. I don't have time right now to experiment, though:

onOverlayAnimationStart(event: AnimationEvent) {
switch (event.toState) {
case 'visible':
if (this.popup) {
this.container = event.element;
this.moveOnTop();
this.onShow.emit({});
this.appendOverlay();
this.alignOverlay();
this.bindDocumentClickListener();
this.bindDocumentResizeListener();
this.bindScrollListener();
DomHandler.focus(this.listViewChild.nativeElement);
this.changeFocusedOptionIndex(0);

Shouldn't this this.changeFocusedOptionIndex(0); be set to -1?

@jesuspa17
Copy link

Any update?

@rtv10dev
Copy link

rtv10dev commented Feb 6, 2024

Any update?

It looks like it is still happening

@pablodmngz98
Copy link

It would be nice if this could be fixed

@aaron-everly
Copy link

This would be a nice small fix. It is confusing, especially for menus with 2 items. Hovering the next item in the list makes both look active.

@PacoMPerez
Copy link

I'm facing the same issue, while PrimeNG fix this at some point I have this workaround:

Captura desde 2024-02-20 18-00-35

I've added this to _tieredmenu.scss, basically I'm overwritting the background set on _mixins.scss for the focus on menuitems.

@mscharrig
Copy link

Please fix this problem, it is extremely annoying. Or at least give us a way to control the focus behavior.

@dalenguyen
Copy link
Contributor

I created fix for this one. Let's wait for feedback from team :)

@cetincakiroglu cetincakiroglu added this to the 17.13.0 milestone Mar 14, 2024
@cetincakiroglu cetincakiroglu added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Mar 22, 2024
cetincakiroglu added a commit that referenced this issue Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

Successfully merging a pull request may close this issue.