Repository navigation
feat(note): sync the md theme with Material Design 2 - #31741
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||
| /// @prop - Padding bottom for a note in the start/end slot | ||
| $item-md-note-slot-padding-bottom: 10px; | ||
| $item-md-note-slot-padding-bottom: 0; |
There was a problem hiding this comment.
Native MD2 for comparison: Compose Material's ListItem with a trailing caption, the same role as a slotted note. Left is the plain render, right shows layout bounds.
- In two- and three-line rows, the caption sits at the top, with its baseline 28dp from the top
- Nothing is added below the caption, so the row's height comes from the text, not the caption
That's why the note keeps 16px above it and drops the 10px below. It matches native, and a note no longer makes an item divider taller.
There was a problem hiding this comment.
This is expected based on my findings on native.
brandyscarney
left a comment
There was a problem hiding this comment.
Optional requests, but looks good!
ShaneK
left a comment
There was a problem hiding this comment.
Looks good to me, just one optional screenshot nit!
| */ | ||
| configs({ modes: ['md'] }).forEach(({ title, screenshot, config }) => { | ||
| configs({ modes: ['md', 'ionic-md'] }).forEach(({ title, screenshot, config }) => { | ||
| test.describe(title('note: item-divider'), () => { |
There was a problem hiding this comment.
| test.describe(title('note: item-divider'), () => { | |
| test.describe(title('note: item-divider'), () => { | |
| test('should not have visual regressions when next to a label in an item-divider', async ({ page }) => { | |
| await page.setContent( | |
| ` | |
| <ion-item-divider> | |
| <ion-label>Label</ion-label> | |
| <ion-note slot="end">99</ion-note> | |
| </ion-item-divider> | |
| `, | |
| config | |
| ); | |
| const itemDivider = page.locator('ion-item-divider'); | |
| await expect(itemDivider).toHaveScreenshot(screenshot(`note-item-divider-label`)); | |
| }); | |
Could we add a screenshot for a divider with a label and a note? The test page has three of those now, but the item-divider screenshots only cover a note on its own, so the md height change for that case (42px to 40px) is only checked by hand. This test fails against the base branch in md and ionic, so it does catch the change here. It'll need new note-item-divider-label snapshots from CI. Nit though, up to you!
Co-authored-by: Shane <[email protected]>
Issue number: internal
What is the current behavior?
The md note is 14px with an inherited line height and letter spacing. Inside md items and item dividers, the parent shrinks it to 11px and adds 18px above and 10px below a note in the start or end slot.
What is the new behavior?
The md note matches the caption style Material Design 2 uses for a list's metadata (Material Components Web 14 and the MD2 kit):
1rem(16px) line height, and0.0333em(0.4px) letter spacingion-labelis 40px instead of 42px, and one without is 33pxThe note keeps its current color. MDC's 38% hint color fails contrast, and native MD2 lists use high emphasis.
Does this introduce a breaking change?
The md note is smaller and now sets its line height and letter spacing. To revert to the previous appearance, set
IonNote.font.size,IonNote.line.heightandIonNote.letterSpacingfor global styles, or--ion-note-font-size,--ion-note-line-heightand--ion-note-letter-spacingfor component-specific styles. To keep 11px notes in items and item dividers, set--ion-note-font-sizeon them, such asion-item ion-note.Other information
Known gaps
How to test
note-item-divider-*snapshots show the beforeOnly md snapshots change, plus the ionic font scaling snapshot for the item divider note's size.