Skip to content

Commit fc63492

Browse files
committed
fix more
1 parent d6fd163 commit fc63492

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/cdk/menu/menu-bar.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,19 @@ export class CdkMenuBar extends CdkMenuBase implements AfterContentInit {
6363
*/
6464
_handleKeyEvent(event: KeyboardEvent) {
6565
const keyManager = this.keyManager;
66+
67+
const element = this._elementRef.nativeElement;
68+
const target = _getEventTarget(event) as HTMLElement;
69+
if (target !== element && target.parentElement !== element) {
70+
return;
71+
}
72+
6673
switch (event.keyCode) {
6774
case UP_ARROW:
6875
case DOWN_ARROW:
6976
case LEFT_ARROW:
7077
case RIGHT_ARROW:
71-
const target = _getEventTarget(event) as HTMLElement;
72-
73-
if (!hasModifierKey(event) && target.parentElement === this._elementRef.nativeElement) {
78+
if (!hasModifierKey(event)) {
7479
const horizontalArrows = event.keyCode === LEFT_ARROW || event.keyCode === RIGHT_ARROW;
7580
// For a horizontal menu if the left/right keys were clicked, or a vertical menu if the
7681
// up/down keys were clicked: if the current menu is open, close it then focus and open the

0 commit comments

Comments
 (0)