Skip to content

fix(list): incorrect padding for list-items with avatars, icons #9163

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

devversion
Copy link
Member

Currently list-items with an avatar, icon or checkbox have a both-sided margin for the text of 16px, while there is still a padding of 16px for the mat-list-item-content of 16px. This means that there is a 32px padding, that is not valid per specs.

The padding for the mat-list-text should be just on the side of the secondary item (e.g. avatar, icon or checkbox), and the other side should have no padding, because the mat-list-item-content already has a padding for that one.

image

image

Fixes #9156

Currently list-items with an avatar, icon or checkbox have a both-sided margin for the text of 16px, while there is still a padding of 16px for the `mat-list-item-content` of 16px. This means that there is a 32px padding, that is not valid per specs.

The padding for the mat-list-text should be just on the side of the secondary item (e.g. avatar, icon or checkbox), and the other side should have no padding, because the `mat-list-item-content` already has a padding for that one.

Fixes angular#9156
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 29, 2017
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crisbeto crisbeto added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Dec 29, 2017
@devversion devversion added the target: patch This PR is targeted for the next patch release label Dec 29, 2017
@andrewseguin andrewseguin merged commit dfbd8d2 into angular:master Jan 12, 2018
andrewseguin pushed a commit to andrewseguin/components that referenced this pull request Jan 12, 2018
…lar#9163)

Currently list-items with an avatar, icon or checkbox have a both-sided margin for the text of 16px, while there is still a padding of 16px for the `mat-list-item-content` of 16px. This means that there is a 32px padding, that is not valid per specs.

The padding for the mat-list-text should be just on the side of the secondary item (e.g. avatar, icon or checkbox), and the other side should have no padding, because the `mat-list-item-content` already has a padding for that one.

Fixes angular#9156
andrewseguin pushed a commit that referenced this pull request Jan 17, 2018
Currently list-items with an avatar, icon or checkbox have a both-sided margin for the text of 16px, while there is still a padding of 16px for the `mat-list-item-content` of 16px. This means that there is a 32px padding, that is not valid per specs.

The padding for the mat-list-text should be just on the side of the secondary item (e.g. avatar, icon or checkbox), and the other side should have no padding, because the `mat-list-item-content` already has a padding for that one.

Fixes #9156
@andrewseguin
Copy link
Contributor

Turns out this caused an issue that was caught in screenshot diffs internally.

If there is no avatar or icon, the mat-list-text should have no padding due to the rule:

&:nth-child(2) {
  padding: 0;
}

However, it is now always overridden to have padding again by the following CSS:



  // There can be a secondary item (e.g. avatar-icon, checkbox) at the start of the
  // list-item. This means that there should be a padding for the mat-list-text on the start-side.
  .mat-list-item-content .mat-list-text {
    padding-left: $mat-list-side-padding;

    [dir='rtl'] & {
      padding-right: $mat-list-side-padding;
      padding-left: 0;
    }
  }

  // Reversed content is mainly used by the MatSelectionList for displaying the checkbox at the
  // end of the list option. Since there is a secondary item (checkbox) at the end of the
  // option, there needs to be a padding for the mat-list-text on the end-side.
  .mat-list-item-content-reverse .mat-list-text {
    padding-left: 0;
    padding-right: $mat-list-side-padding;

    [dir='rtl'] & {
      padding-right: 0;
      padding-left: $mat-list-side-padding;
    }
  }

A likely fix would be to just define those styles in a different order

andrewseguin added a commit to andrewseguin/components that referenced this pull request Jan 17, 2018
andrewseguin added a commit that referenced this pull request Jan 17, 2018
andrewseguin added a commit that referenced this pull request Jan 17, 2018
@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 Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Selection lists list item misaligned
5 participants