bug([Mat Buttons: (not fabs]): Placing Mat Buttons inside a <a> with display: flex brings back link underline text
https://stackblitz.com/github/mikejunt/mat-button-example
Steps to reproduce:
- Place a button with any mat-button directive (button, raised, flat, stroked, icon) inside an anchor tag
- Style the anchor tag with display: flex (for example to use justify-content or align-content
Expected Behavior
In all other circumstances, link styling is removed from button text on material buttons that are links
Actual Behavior
Underlines. Note that this behavior is NOT present if you use display: -webkit-box.
Environment
- Angular: 9.0.5
- CDK/Material: 9.1.2
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 Pro
I don't think this falls under the purview Angular Material; the components apply their own styles, but we don't touch the styles for elements the library doesn't "own" (in this case, a plain <a>). It would be up to the application to reset any browser-agent styles.
That's fair though using a button for a link is a fairly common use case, and the issue is caused by the display: flex. Removing it, or having an intermediate element (eg a div in between the anchor and the button) removes the issue.
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.