Skip to content

fix(material/menu): prevent interaction with <a> in disabled menu items (#30203) #30261

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

Conversation

IgnacioCabanellas
Copy link

Fix the issue where tags inside disabled mat-menu-items were still interactive, allowing users to navigate even when the menu item was disabled.

Problem:

  • The anchor links inside disabled mat-menu-items were still interactive.
  • Users could right click on them and navigate to the associated link with the Open link in new tab for example, despite the items being disabled.

Solution:

  • Added the CSS rule pointer-events: none; to disable interaction with anchor tags inside disabled mat-menu-item elements.

Additional Information:

Fixes #30203

@IgnacioCabanellas IgnacioCabanellas requested a review from a team as a code owner January 2, 2025 00:48
@IgnacioCabanellas IgnacioCabanellas requested review from crisbeto and mmalerba and removed request for a team January 2, 2025 00:48
@IgnacioCabanellas IgnacioCabanellas changed the title fix(material/menu): prevent interaction with <a> in disabled menu ite… fix(material/menu): prevent interaction with <a> in disabled menu items (#30203) Jan 2, 2025
@crisbeto
Copy link
Member

crisbeto commented Jan 2, 2025

We intentionally removed the pointer-events: none in #19183 to avoid a different issue.

@IgnacioCabanellas IgnacioCabanellas marked this pull request as draft January 2, 2025 09:42
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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