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

fix(material/list): list item truncates on narrow screen widths #29033

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

essjay05
Copy link
Contributor

Fixes issue with Angular Components List component where the list item truncates on narrow screen widths (ie. mobile screens). Removes white-space wrap style and adds some height to primary lines for readability.

Before screenshot
After screenshot

Fixes b/291296866

@andrewseguin andrewseguin added the dev-app preview When applied, previews of the dev-app are deployed to Firebase label May 13, 2024
Copy link

github-actions bot commented May 13, 2024

Deployed dev-app for 91b2390 to: https://ng-dev-previews-comp--pr-angular-components-29033-dev-ty3sw382.web.app

Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt.

@essjay05 essjay05 marked this pull request as ready for review May 13, 2024 16:18
line-height: normal;
}
.mat-mdc-list-item-title.mdc-list-item__primary-text {
height: 45px;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand why this is added. It's moving the secondary text closer to the primary text, and I don't see how it improves readability

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @andrewseguin! Removed previous attempt to improve readability and revised by increasing the list items with 3 lines from 88px to min-height 90px so that the bottom letters of the 3rd line do not get cut off. See screenshots for reference:

Copy link
Contributor

Choose a reason for hiding this comment

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

Hardcoding the heights won't work if the text needs to wrap to several lines. Try adding more secondary text to see that it only shows two lines.

Ideally the text container grows as necessary and doesn't set height at all. This might require making more significant changes to the list item styles

For example, we might want to get rid of height: var(--mdc-list-list-item-three-line-container-height); altogether

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @andrewseguin! Thanks for the rec. I did some further digging and it looks like that variable (value of 88px) is coming from _list.js theming for density (screenshot here) . Would it be better to override the value by adding in a height: auto in the list.scss or remove the specific values from the theming? Honestly I haven't worked directly with affecting overall theming so wanted to check before moving in that direction.

@essjay05 essjay05 force-pushed the fix-list-item-truncate-small-screens branch 4 times, most recently from d12043b to 9e08fcc Compare May 16, 2024 15:50
@essjay05 essjay05 force-pushed the fix-list-item-truncate-small-screens branch 2 times, most recently from 1d9b95a to 4023349 Compare May 22, 2024 21:08
@essjay05 essjay05 force-pushed the fix-list-item-truncate-small-screens branch from 4023349 to dff207f Compare May 22, 2024 22:18
Fixes issue with Angular Components List component where the list
item truncates on narrow screen widths (ie. mobile screens).
Removes white-space wrap style and adds some height to primary
lines for readability.

Fixes b/291296866
Updates Angular Components List item component height if the
list item has 3 lines. With the previous list item height of
88px the bottom lines letters like 'g' get cut off and less
readable.

Fixes b/247881646
Fixes Angular Components List item component with and without
a leading avatar if it is has multiple lines for the height
to auto adjust based on the content. Added padding-bottom
for list items with a leading icon/avatar/checkbox to improve
readability.

Fixes b/291296866
Fixes bottom padding beneath Antular Components List item with
leading avatar to provide a similar space as exists above the
list item.

Fixes b/291296866
@essjay05 essjay05 force-pushed the fix-list-item-truncate-small-screens branch from dff207f to 91b2390 Compare May 23, 2024 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev-app preview When applied, previews of the dev-app are deployed to Firebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants