Skip to content
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

bug(COMPONENT): Inconsistency in behavior of a[mat-button] and a[mat-menu-item] when disabled #30203

Open
1 task
reuse-ay opened this issue Dec 18, 2024 · 5 comments · May be fixed by #30261
Open
1 task

bug(COMPONENT): Inconsistency in behavior of a[mat-button] and a[mat-menu-item] when disabled #30203

reuse-ay opened this issue Dec 18, 2024 · 5 comments · May be fixed by #30261
Labels
Accessibility This issue is related to accessibility (a11y) area: material/menu P4 A relatively minor issue that is not relevant to core functions

Comments

@reuse-ay
Copy link

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

This may be a feature request.

When a[mat-button] is disabled, if you right-click it, the menu will be the normal one, but if you right-click a[mat-menu-item], the options for clicking a link will be displayed, and you can actually navigate to the page.

Reproduction

https://github.com/reuse-ay/angular-mat-a.git

Expected Behavior

When a[mat-menu-item] is disabled, I don’t want the option for the link to be displayed.

Actual Behavior

option for the link to be displayed.

Environment

  • Angular:19
  • CDK/Material:19
  • Browser(s):chrome
  • Operating System (e.g. Windows, macOS, Ubuntu):windows
@reuse-ay reuse-ay added the needs triage This issue needs to be triaged by the team label Dec 18, 2024
@amysorto
Copy link
Contributor

Can you add your reproduction to a Stackblitz?

@amysorto amysorto added Accessibility This issue is related to accessibility (a11y) needs: clarification The issue does not contain enough information for the team to determine if it is a real bug area: material/menu and removed needs triage This issue needs to be triaged by the team labels Dec 18, 2024
@reuse-ay
Copy link
Author

@shhdharmen
Copy link

Setting the pointer-events: none seems to fix the issue:

.mat-mdc-menu-item[disabled] {
    pointer-events: none;
}

@amysorto
Copy link
Contributor

@reuse-ay Thanks for the StackBlitz, thats really helpful.

Hmm it does seem like tabindex is being set to -1 for both, and both disabled and aria-disabled is being set to true correctly.

I do see the context menu on Chrome and Safari that has the options to navigate to link despite it being disabled, and its only happening in the mat-menu-item elements like you mentioned.
Image
Image

@shhdharmen I tried adding that code but still see option to navigate to the link.

@amysorto amysorto added P4 A relatively minor issue that is not relevant to core functions and removed needs: clarification The issue does not contain enough information for the team to determine if it is a real bug labels Dec 20, 2024
@shhdharmen
Copy link

shhdharmen commented Dec 22, 2024

@amysorto I think it's CSS specificity. If you add !important, you will notice it's fixed.

Demo: https://stackblitz.com/edit/github-w9fhqnyb?file=src%2Fstyles.scss

I think it can be added around this line:

opacity: 0.38;
, we would not need !important there I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility This issue is related to accessibility (a11y) area: material/menu P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
3 participants