Skip to content

Commit caa8f7b

Browse files
committed
fix(material/menu): prevent pointer events on animating menu (#26323)
Ports over a fix from the legacy menu to the MDC-based one. Disables pointer events on a menu that is still animating in order to prevent wrong taps. Fixes #26306. (cherry picked from commit dffb07b)
1 parent b85b3cf commit caa8f7b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/material/menu/menu.scss

+11
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ mat-menu {
2222
}
2323

2424
.mat-mdc-menu-panel {
25+
// Prevent users from interacting with the panel while it's animating. Note that
26+
// people won't be able to click through it, because the overlay pane will catch the click.
27+
// This fixes the following issues:
28+
// * Users accidentally opening sub-menus when the `overlapTrigger` option is enabled.
29+
// * Users accidentally tapping on content inside the sub-menu on touch devices, if the
30+
// sub-menu overlaps the trigger. The issue is due to touch devices emulating the
31+
// `mouseenter` event by dispatching it on tap.
32+
&.ng-animating {
33+
pointer-events: none;
34+
}
35+
2536
@include cdk.high-contrast(active, off) {
2637
outline: solid 1px;
2738
}

0 commit comments

Comments
 (0)