Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ShaneK
left a comment
There was a problem hiding this comment.
Looks good to me! Just a couple of small things on the states.
| state: { | ||
| disabled: { | ||
| opacity: '0.4', | ||
| opacity: '0.38', |
There was a problem hiding this comment.
I don't think anything tests the new md focus and disabled values yet. The states test only runs ios and ionic-md, with a comment saying md doesn't differ from ios, which isn't true after this PR. The regenerated md screenshots are all resting chips, so if these went back to 0.16 and 0.4 CI would still pass.
Could you add 'md' to that test's configs and drop the comment? If you'd rather not add more screenshots, something like this works too. It passes on this branch and fails on ionic-modular:
/**
* This behavior does not vary across directions.
*/
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config }) => {
test.describe(title('chip: md states'), () => {
test('should use the MD2 focus backgrounds', async ({ page }) => {
await page.setContent(
`
<ion-chip class="ion-focused" fill="solid">Solid</ion-chip>
<ion-chip class="ion-focused" fill="outline">Outline</ion-chip>
`,
config
);
const chips = page.locator('ion-chip');
await expect(chips.nth(0)).toHaveCSS('background-color', 'rgba(0, 0, 0, 0.21)');
await expect(chips.nth(1)).toHaveCSS('background-color', 'rgba(0, 0, 0, 0.1)');
});
test('should use the MD2 disabled opacity', async ({ page }) => {
await page.setContent(`<ion-chip disabled="true">Disabled</ion-chip>`, config);
await expect(page.locator('ion-chip')).toHaveCSS('opacity', '0.38');
});
});
});There was a problem hiding this comment.
basic/chip.e2e.ts has the same "md doesn't differ from ios" comment (line 60), so it might be worth updating that one too while you're in there.
There was a problem hiding this comment.
Added md to the states test and removed the comment in 0e17e58, so the md focus and disabled screenshots now cover these values. I went with screenshots over the toHaveCSS checks to match the rest of the spec.
There was a problem hiding this comment.
Updated in 0e17e58. The hue tests already screenshot the md outline and color chips, so the comment now points there instead of adding md to this test.
|
|
||
| activated: { | ||
| background: rgba('var(--ion-text-color-rgb, 0, 0, 0)', 0.2), | ||
| background: rgba('var(--ion-text-color-rgb, 0, 0, 0)', 0.21), |
There was a problem hiding this comment.
With the activated backgrounds removed, pressing a chip while hovering it with a mouse drops it back to its resting background, since the .ion-activated rule comes after :hover and falls back to the default. A bold solid chip goes from 0.16 on hover to 0.12 while pressed (it was 0.20 before), and an outline chip goes from 0.04 to transparent. The ripple still shows, but the chip gets lighter as you click it.
Was that intended for mouse too? Setting the activated backgrounds to the hover values would fix it on desktop, but I think it'd also tint touch presses, so I'm not sure which way is better here.
There was a problem hiding this comment.
One more case: colored chips do the same. A bold solid chip with a color goes from 12% of its color on hover to 8% while pressed, and a bold outline one goes from 12% to transparent, since the semantic activated backgrounds are gone too.
One way to fix it without tinting touch presses: move the @media (any-hover: hover) hover blocks after the .ion-activated rules in chip.scss, so hover wins while the pointer is over the chip and pressing just adds the ripple. That matches MDC, which keeps the hover layer under the press ripple.
There was a problem hiding this comment.
Not intended on desktop. Fixed in 29e7fe5: a hovered chip that's pressed now keeps its hover background, so it shows the hover tint plus the ripple. Touch presses stay untinted, since the new rule only applies inside (any-hover: hover) while the chip is hovered. Themes that set an activated background, like ios, still use it.
I also added a test that covers every hue, fill and color.
There was a problem hiding this comment.
Fixed in 29e7fe5, colored chips included. I didn't move the hover blocks after the activated rules: ios keeps a pressed background that's darker than its hover one, and on desktop hover would hide it. Instead, an .ion-activated:hover rule inside (any-hover: hover) falls back from the activated background to the hover one. md keeps the hover layer under the ripple like MDC, and ios keeps its pressed value.
brandyscarney
left a comment
There was a problem hiding this comment.
Looks good! Requesting changes for three things: the md outline chips are 2px taller than MD2 (34px large, 26px small), a hovered chip gets lighter when pressed now that the activated backgrounds are gone, and BREAKING.md is missing the subtle outline border change and the activated values to revert to. The rest are smaller questions and nits.
| }, | ||
|
|
||
| line: { | ||
| height: `${20 / components.chip.font.size}`, |
There was a problem hiding this comment.
With the explicit 20px line height, the large outline chips end up 34px tall: 6 + 20 + 6 + 2px of border. You can see it in the regenerated chip-hue-*-md snapshots, where the outline rows are 34px and the solid rows are 32px. Small outline chips work out to 26px instead of 24px. MD2's outlined chip is 32dp including the stroke. Could the outline variants take the border width out of the vertical padding?
There was a problem hiding this comment.
Fixed in adfb6c9. Outline chips now take their border width out of the vertical padding, so md outline chips are 32px and 24px like the solid ones.
I first tried dropping the vertical padding the way MDC does, but wrapped and scaled chips then lost their padding in the large text tests. The fix lives in chip.scss, so it also brings the ios outline chips from 30px to 28px in the ios PR.
|
|
||
| activated: { | ||
| background: rgba('var(--ion-text-color-rgb, 0, 0, 0)', 0.2), | ||
| background: rgba('var(--ion-text-color-rgb, 0, 0, 0)', 0.21), |
There was a problem hiding this comment.
One more case: colored chips do the same. A bold solid chip with a color goes from 12% of its color on hover to 8% while pressed, and a bold outline one goes from 12% to transparent, since the semantic activated backgrounds are gone too.
One way to fix it without tinting touch presses: move the @media (any-hover: hover) hover blocks after the .ion-activated rules in chip.scss, so hover wins while the pointer is over the chip and pressing just adds the ripple. That matches MDC, which keeps the hover layer under the press ripple.
| state: { | ||
| disabled: { | ||
| opacity: '0.4', | ||
| opacity: '0.38', |
There was a problem hiding this comment.
basic/chip.e2e.ts has the same "md doesn't differ from ios" comment (line 60), so it might be worth updating that one too while you're in there.
| - In the `md` theme, the chip now has a letter spacing of `0.0179em` (`0.25px` at `14px`), and the `large` chip a line height of `20px`, instead of inherited, in accordance with the Material Design 2 guidelines. To revert to the previous appearance, set `IonChip.size.large.letterSpacing` and `IonChip.size.large.line.height` to `inherit` for global styles, or `--ion-chip-size-large-letter-spacing` and `--ion-chip-size-large-line-height` for component-specific styles. | ||
| - In the `md` theme, a slotted `ion-icon` now has `4px` of space between it and the label instead of `8px`, in accordance with the Material Design 2 guidelines. To revert to the previous appearance, set `IonChip.icon.leading.margin.end` and `IonChip.icon.trailing.margin.start` to `8px` for global styles, or `--ion-chip-icon-leading-margin-end` and `--ion-chip-icon-trailing-margin-start` for component-specific styles. | ||
| - In the `md` theme, the border of an outline chip without a `color` is now `12%` of the text color instead of `32%`, in accordance with the Material Design 2 guidelines. To revert to the previous appearance, set `IonChip.hue.bold.outline.default.border.color` to `rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.32)` for global styles, or `--ion-chip-hue-bold-outline-default-border-color` for component-specific styles. | ||
| - In the `md` theme, a focused chip without a `color` now has a background of `21%` of the text color instead of `16%`, or `10%` instead of `4%` with an outline fill. A pressed chip now keeps its resting background under the ripple instead of darkening. Both follow the Material Design 2 guidelines. To revert to the previous appearance, set `IonChip.hue.bold.solid.focus.background`, `IonChip.hue.bold.outline.focus.background` and the `activated.background` of each hue and fill for global styles, or the matching `--ion-chip-hue-*-focus-background` and `--ion-chip-hue-*-activated-background` variables for component-specific styles. |
There was a problem hiding this comment.
Could this one list the values to revert to, like the other bullets do? The previous values were:
- Focus:
16%(bold solid) and4%(bold outline) - Activated:
20%(bold solid),8%(bold outline),14%(subtle solid) and4%(subtle outline) of the text color - Activated with a
color:16%of the color (bold) and80%of the subtle color (subtle)
It's also worth saying that colored chips stop darkening when pressed too.
Separately, the subtle outline border also changes from 16% to 12%, but the border bullet only mentions IonChip.hue.bold.outline.default.border.color. Could that bullet cover IonChip.hue.subtle.outline.default.border.color (0.16) as well?
There was a problem hiding this comment.
Listed the bold focus and activated values to revert to in 9512e85, and the pressed bullet now says colored chips stop darkening too.
I left out the subtle values, including the subtle outline border. The subtle hue is new in v10 and hasn't been released, so there's no previous appearance to revert to.
| - The `outline` property has been deprecated. To achieve an outlined chip, set the `fill` property to `"outline"`. The class `.chip-outline` has also been updated to `.chip-fill-outline` for clarity. | ||
| - Specific mode classes (e.g., `ion-chip.md`) are no longer supported. Style modifications based on the active theme must be implemented using theme tokens rather than direct class targeting. | ||
| - The `border-radius` of the `ios` and `md` chip now defaults to `10px` and `8px`, respectively, instead of `16px` in accordance with the iOS and Material Design 3 guidelines. To revert to the previous appearance, set the `shape` to `"round"`, or override the `IonChip.shape.round.border.radius` to specify a different value for global styles and `--ion-chip-shape-round-border-radius` for component-specific styles. | ||
| - The `border-radius` of the `ios` chip now defaults to `10px` instead of `16px` in accordance with the iOS guidelines. The `md` chip keeps its pill shape, in accordance with the Material Design 2 guidelines. To revert to the previous appearance, set the `shape` to `"round"`, or override the `IonChip.shape.round.border.radius` to specify a different value for global styles and `--ion-chip-shape-round-border-radius` for component-specific styles. |
There was a problem hiding this comment.
Nit: since md already defaults to round, the "To revert … set the shape to "round"" sentence only applies to ios now. Maybe scope it to ios?
| small: { | ||
| padding: { |
There was a problem hiding this comment.
With the start/end padding at 8px now, a slotted avatar (still -8px margin) sits right against the edge of the small chip, while the large one keeps a 4px inset. Intentional?
The 24px avatar with -4px top and bottom margins also fills the 24px chip edge to edge vertically.
There was a problem hiding this comment.
Not intended. Fixed in cf65a8a: the avatar margins now live under each size, and the small md chip uses -6px, so the avatar sits 2px from the edge, matching its vertical inset.
The avatar in a small chip is 24/14em of its 12px font, about 21px, so it doesn't fill the 24px chip edge to edge.
# Conflicts: # core/src/components/avatar/test/basic/avatar.e2e.ts-snapshots/avatar-chip-diff-md-ltr-Mobile-Firefox-linux.png # core/src/components/chip/test/a11y/chip.e2e.ts-snapshots/chip-large-contents-md-ltr-Mobile-Firefox-linux.png
Issue number: internal
What is the current behavior?
The md chip has
8pxcorners and inherits its letter spacing and line height. It has8pxbetween an icon and the label, a32%outline border, and lighter focus backgrounds than Material Design 2. A pressed chip darkens under the ripple. Its rem and em values are rounded to two decimals, so it renders slightly larger than onnext(14.08pxinstead of14px).What is the new behavior?
The md chip matches Material Design 2 (Material Components Web 14 and the MD2 kit):
round).softstays8px0.0179em(0.25px) letter spacing. Thelargechip has a20pxline height. Thesmallchip has4px8pxpadding and a16pxline height, which keep it at24px, since MD2 has no small chip4pxbetween a slotted icon and the labelcolorhave a12%border21%(solid) and10%(outline). A pressed chip keeps its resting background, and the ripple shows the press0.38nextpadding,letterSpacingandline.heightmove under each size (for exampleIonChip.size.large.padding). The ionic theme looks the sameDoes this introduce a breaking change?
The md chip changes its shape, typography, icon spacing, outline border, focus and pressed backgrounds, and disabled opacity. The chip section of
BREAKING.mdlists each one with the global token and CSS variable that revert it.Other information
How to test