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(MatListItem): Misalignment of Button Icon in Two-Line MatListItem #29065

Closed
1 task done
zerbusdetroy opened this issue May 17, 2024 · 1 comment
Closed
1 task done
Labels
needs triage This issue needs to be triaged by the team

Comments

@zerbusdetroy
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

16

Description

When using a Button Icon as matListItemMeta in a two-line MatListItem, the icon is not properly centered within the button. This misalignment appears to be caused by the display: inline-block; property in the .mdc-list-item--with-trailing-meta.mdc-list-item--with-two-lines .mdc-list-item__end::before selector.

Reproduction

StackBlitz link: https://stackblitz.com/edit/jytzjx?file=src%2Fexample%2Flist-overview-example.html

Expected Behavior

The Button Icon should be vertically and horizontally centered within the button in a two-line MatListItem.

Actual Behavior

The Button Icon is not centered within the button, leading to a misalignment in the UI.

Environment

  • Angular: 17.3.9
  • CDK/Material: 17.3.9
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS
@zerbusdetroy zerbusdetroy added the needs triage This issue needs to be triaged by the team label May 17, 2024
@crisbeto
Copy link
Member

matListItemMeta is meant to be used as a container. Something like this should work:

<div matListItemMeta>
  <button mat-icon-button>
    <mat-icon fontIcon="home"></mat-icon>
  </button>
</div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue needs to be triaged by the team
Projects
None yet
Development

No branches or pull requests

2 participants