Skip to content

Nested menus bug: parent menu-item left focused after click (onPush) #6838

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

Closed
RichieRock opened this issue Sep 5, 2017 · 1 comment · Fixed by #6853
Closed

Nested menus bug: parent menu-item left focused after click (onPush) #6838

RichieRock opened this issue Sep 5, 2017 · 1 comment · Fixed by #6853
Assignees

Comments

@RichieRock
Copy link

Bug, feature request, or proposal:

Bug: When using onPush strategy, in nested menus, the parent is left focused after click even after mouse is not hovering anymore and its submenu is closed.

What is the expected behavior?

Items should be only focused when their submenu is open.

What is the current behavior?

In the following gif, I first hover over items and submenus open and close normally. Then I click on Item 2, and hover on Item 3. Item 2 is left focused even if the submenu has been closed (after mouseleave). Same thing is visible for Item 3: when clicked, it stays focused until another item is clicked.

Behaviour

What are the steps to reproduce?

The given plunkr template (https://goo.gl/DlHd6U) did not load but instead was giving me some 404 errors for steppers (any idea why?). But it's easy to reproduce with this html AND using onPush in ts:

<button md-button [mdMenuTriggerFor]="menu">Trigger</button>
<md-menu #menu>
    <div md-menu-item>Item 1</div>
    <div md-menu-item [mdMenuTriggerFor]="submenu1">Item 2</div>
    <div md-menu-item [mdMenuTriggerFor]="submenu2">Item 3</div>
</md-menu>
<md-menu #submenu1>
    <div md-menu-item>SubItem 1</div>
    <div md-menu-item>SubItem 2</div>
    <div md-menu-item>SubItem 3</div>
</md-menu>
<md-menu #submenu2>
    <div md-menu-item>SubItem 4</div>
    <div md-menu-item>SubItem 5</div>
    <div md-menu-item>SubItem 6</div>
</md-menu>
@Component({
  ...
  changeDetection: ChangeDetectionStrategy.OnPush
})

What is the use-case or motivation for changing an existing behavior?

This is a bug and should be fixed, imho.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

"@angular/cdk": "2.0.0-beta.10",
"@angular/common": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/material": "2.0.0-beta.10",
"typescript": "2.4.2"

Tested with Chrome 60 on Linux.

@crisbeto crisbeto self-assigned this Sep 5, 2017
@crisbeto crisbeto added the has pr label Sep 5, 2017
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 5, 2017
Prevents the sub-menu trigger from staying highlighted if the user clicks on it and moves away to another menu item.

Fixes angular#6838.
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 5, 2017
Prevents the sub-menu trigger from staying highlighted if the user clicks on it and moves away to another menu item.

Fixes angular#6838.
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 11, 2017
Prevents the sub-menu trigger from staying highlighted if the user clicks on it and moves away to another menu item.

Fixes angular#6838.
crisbeto added a commit to crisbeto/material2 that referenced this issue Sep 12, 2017
Prevents the sub-menu trigger from staying highlighted if the user clicks on it and moves away to another menu item.

Fixes angular#6838.
mmalerba pushed a commit that referenced this issue Sep 12, 2017
* fix(menu): nested trigger staying highlighted after click

Prevents the sub-menu trigger from staying highlighted if the user clicks on it and moves away to another menu item.

Fixes #6838.

* fix: firefox tests crashing
josephperrott pushed a commit to josephperrott/components that referenced this issue Sep 15, 2017
* fix(menu): nested trigger staying highlighted after click

Prevents the sub-menu trigger from staying highlighted if the user clicks on it and moves away to another menu item.

Fixes angular#6838.

* fix: firefox tests crashing
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants