components icon indicating copy to clipboard operation
components copied to clipboard

Mat-menu not allowing key strokes with menu items from components

Open kbondsj opened this issue 6 years ago • 6 comments

Reproduction

Use StackBlitz to reproduce your issue: https://stackblitz.com/edit/angular-7-mat-menu (works) https://stackblitz.com/edit/angular-9-mat-menu (broken)

Steps to reproduce:

  1. Set up a button to be used with a mat-menu
  2. In the mat-menu, use 2 buttons as well as use a custom component that has just a button
  3. Using the keyboard, tab to your button and then open it, try to navigate using arrows
  4. Only the 2 buttons explicitly listed in the template will navigate, the button from the component will not allow keyboard navigation. The manuData is missing for that element.

Expected Behavior

What behavior were you expecting to see? This was working before we upgraded to version 9. I have created 2 stackblitzes with the same example. @angular 7 works, @angular 8 and 9 do not.

Actual Behavior

What behavior did you actually see? The items that are listed as direct children are properly navigated to using arrow keys. The ones rendered from custom component are skipped.

Environment

  • Angular: 9.0.2
  • CDK/Material: 8.2.3
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10

kbondsj avatar Feb 19 '20 21:02 kbondsj

@kbondsj

Angular: 9.0.2

In your stackblitz, most of angular is at 9.0.0-rc.1

CDK/Material: 8.2.3

Since there is a big bunch of changes for Angular 9, i dont think its a good idea to use Material 8 with angular 9.

manklu avatar Feb 20 '20 06:02 manklu

Yes, it's worth mentioning that I found the issue in @angular8 as well. I upgraded the stack to 9 to see if got fixed but it hadn't. I can revert the stack if it suits you. Issue was found on @angular8.2.14

kbondsj avatar Feb 20 '20 16:02 kbondsj

I just updated https://stackblitz.com/edit/angular-9-mat-menu to use 8.2.14 so you can see the issue still exists.

kbondsj avatar Feb 20 '20 16:02 kbondsj

I also ran into this issue, and determined that this functionality broke starting in Material version 8.1.0.

nienow avatar Apr 15 '20 13:04 nienow

Closing this as a duplicate of https://github.com/angular/components/issues/18617. Thanks for this report!

devversion avatar May 26 '20 17:05 devversion

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.