File tree Expand file tree Collapse file tree 2 files changed +26
-13
lines changed
Expand file tree Collapse file tree 2 files changed +26
-13
lines changed Original file line number Diff line number Diff line change @@ -64,17 +64,25 @@ mat-menu {
6464 min-height : map .get ($height-config , default );
6565
6666 & [disabled ] {
67- // Usually every click inside the menu closes it, however some browsers will stop events
68- // when the user clicks on a disabled item, **except** when the user clicks on a non-disabled
69- // child node of the disabled button. This is inconsistent because some regions of a disabled
70- // button will still cause the menu to close and some won't (see #16694). We make the behavior
71- // more consistent by disabling pointer events and allowing the user to click through.
72- pointer-events : none ;
7367 cursor : default ;
7468
7569 // This is the same as `mdc-list-mixins.list-disabled-opacity` which
7670 // we can't use directly, because it comes with some selectors.
7771 opacity : mdc-list-variables .$content-disabled-opacity ;
72+
73+ // The browser prevents clicks on disabled buttons from propagating which prevents the menu
74+ // from closing, but clicks on child nodes still propagate which is inconsistent (see #16694).
75+ // In order to keep the behavior consistent and prevent the menu from closing, we add an overlay
76+ // on top of the content that will catch all the clicks while disabled.
77+ & ::before {
78+ display : block ;
79+ position : absolute ;
80+ content : ' ' ;
81+ top : 0 ;
82+ left : 0 ;
83+ bottom : 0 ;
84+ right : 0 ;
85+ }
7886 }
7987
8088 .mat-icon {
Original file line number Diff line number Diff line change @@ -49,13 +49,18 @@ mat-menu {
4949 @include menu-common .item-base ();
5050 position : relative ;
5151
52- & [disabled ] {
53- // Usually every click inside the menu closes it, however some browsers will stop events
54- // when the user clicks on a disabled item, **except** when the user clicks on a non-disabled
55- // child node of the disabled button. This is inconsistent because some regions of a disabled
56- // button will still cause the menu to close and some won't (see #16694). We make the behavior
57- // more consistent by disabling pointer events and allowing the user to click through.
58- pointer-events : none ;
52+ // The browser prevents clicks on disabled buttons from propagating which prevents the menu
53+ // from closing, but clicks on child nodes still propagate which is inconsistent (see #16694).
54+ // In order to keep the behavior consistent and prevent the menu from closing, we add an overlay
55+ // on top of the content that will catch all the clicks while disabled.
56+ & [disabled ]::before {
57+ display : block ;
58+ position : absolute ;
59+ content : ' ' ;
60+ top : 0 ;
61+ left : 0 ;
62+ bottom : 0 ;
63+ right : 0 ;
5964 }
6065
6166 @include a11y .high-contrast (active , off) {
You can’t perform that action at this time.
0 commit comments