-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(material/menu): enhance menu item component with interactive disabled state #30730
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
base: main
Are you sure you want to change the base?
feat(material/menu): enhance menu item component with interactive disabled state #30730
Conversation
a61c264
to
90b1bf7
Compare
90b1bf7
to
fe167d5
Compare
src/material/menu/menu.scss
Outdated
@@ -178,6 +180,7 @@ mat-menu { | |||
&[disabled] { | |||
cursor: default; | |||
opacity: 0.38; | |||
pointer-events: none; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this being added? The browser already prevents interaction with disabled elements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point of disableInteractive
is that the item should look disabled, but things like tooltips should still show up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I got that but the tooltip is displayed even when the disabledInteractive
is set to false
and I think it should be shown only in case of disabledInteractive
being set to true
. Similar to checkbox and radio, they do not display tooltip of disabledInteractive
is set to false
, Sorry if was bit unclear :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That shouldn't happen on button
nodes. For anchors it's fine since the browser doesn't really have a concept of them being disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then I remove that style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@crisbeto If you see the below example, here also in disabled
button with mat-tooltip
and no disabledInteractive
tooltip is not displayed. So, shouldn't menu button also be similar to this or the other way round.
https://material.angular.io/components/button/examples#button-disabled-interactive

Also, I see here also we have pointer-events:none
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, its with ::after
pseudo selector now. So, we close this or have it with the background color being different on disabledInteractive
hover ?
2fccb47
to
80b9481
Compare
Deployed dev-app for 36221d3 to: https://ng-dev-previews-comp--pr-angular-components-30730-dev-ry2lo0eh.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
80b9481
to
dc9498b
Compare
dc9498b
to
93c0f60
Compare
93c0f60
to
cf09508
Compare
…abled state In menu-item component add an option `disabledInteractive` to interact with menu item in disabled state similar to `mat-button`, `mat-radio`, etc Fixes angular#29984
cf09508
to
36221d3
Compare
In
menu-item
component add an optiondisabledInteractive
to interact with menu item in disabled state similar tomat-button
,mat-radio
, etcFixes #29984