Repository navigation
Conversation
Recipe values under mediaQuery.min.resolution set the same variable inside a media query. A value a custom theme sets replaces the base theme's media query values for that key, so it applies on every screen.
The line is a filled box instead of a border, since WebKit skips borders thinner than one CSS pixel at some positions. The ios theme sets the thickness per screen density.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
# Conflicts: # core/src/components/chip/test/basic/chip.e2e.ts-snapshots/chip-descender-ios-ltr-Mobile-Chrome-linux.png # core/src/components/chip/test/basic/chip.e2e.ts-snapshots/chip-descender-ios-ltr-Mobile-Firefox-linux.png # core/src/components/chip/test/basic/chip.e2e.ts-snapshots/chip-descender-ios-ltr-Mobile-Safari-linux.png
…o FW-7047 # Conflicts: # core/src/components/popover/test/basic/popover.e2e.ts-snapshots/popover-basic-basic-popover-ionic-md-rtl-light-Mobile-Firefox-linux.png # core/src/components/popover/test/basic/popover.e2e.ts-snapshots/popover-basic-basic-popover-ionic-md-rtl-light-Mobile-Safari-linux.png # core/src/components/popover/test/basic/popover.e2e.ts-snapshots/popover-basic-basic-popover-md-rtl-Mobile-Chrome-linux.png # core/src/components/popover/test/basic/popover.e2e.ts-snapshots/popover-basic-basic-popover-md-rtl-Mobile-Firefox-linux.png # core/src/components/popover/test/basic/popover.e2e.ts-snapshots/popover-basic-basic-popover-md-rtl-Mobile-Safari-linux.png # core/src/components/popover/test/standalone/popover.e2e.ts-snapshots/popover-standalone-basic-popover-md-rtl-Mobile-Chrome-linux.png # core/src/components/popover/test/standalone/popover.e2e.ts-snapshots/popover-standalone-basic-popover-md-rtl-Mobile-Firefox-linux.png # core/src/components/popover/test/standalone/popover.e2e.ts-snapshots/popover-standalone-basic-popover-md-rtl-Mobile-Safari-linux.png
brandyscarney
left a comment
There was a problem hiding this comment.
I reproduced #30772 in Safari on the iPhone 17 simulator (iOS 27, 3x) with a tab bar and a sub-pixel offset. A 0.3334px border and the 0.55px border with overflow: visible both still drop lines. Only a 1px border or a filled element keeps them, and a 1px border isn't a hairline. So I agree with drawing the line as an element and keeping the line/inner-line API the same in every theme.
I checked the comments below in the same simulator against the ionic-modular and fw-7047 previews, measuring screenshot pixels. The first three are regressions, the rest are cleanup.
|
|
||
| The lines between items are drawn with an element instead of a border, so `--border-width` and `--inner-border-width` no longer show, hide or resize them, and `--border-style` no longer changes their style. `--border-color` still sets their color. | ||
|
|
||
| `--border-width` and `--inner-border-width` still draw a border on the item, so an app that set them to thicken a line now gets that border on top of the line. Remove those overrides and style the `line` or `inner-line` part instead. |
There was a problem hiding this comment.
The advice to "style the line or inner-line part instead" won't work for the most common case of making the line thicker. The visible line is a gradient fill of a fixed thickness, so ion-item::part(line) { height: 4px; } still draws 1 screen pixel. I confirmed this in the simulator:
Rows from top to bottom: default line, height: 4px, then height: 4px with background: currentColor.
Adding background: currentColor gives the expected 4px (12 screen pixels at 3x). Could the entry include a thickening example that sets background? Something like:
ion-item::part(line) {
height: 2px;
background: currentColor;
}There was a problem hiding this comment.
Done in a37838d with your example. The item keeps space for the default thickness only (refer to the item.md.scss thread), so the entry also says a thicker line covers the bottom of the content.
| --inner-border-width: 0; | ||
| .item-line, | ||
| .item-inner-line { | ||
| @include hairline(bottom, currentColor, $item-md-border-bottom-width); |
There was a problem hiding this comment.
Since the line no longer takes up layout space, content at the bottom of the item sits on it. With <ion-input label="Email" helper-text="Enter your email" counter="true" maxlength="20"> in an ion-item, Safari on iOS 27 shows 3 clear screen pixels between the "y" descender and the line before this change, and 0 after, so the descender touches the line. ios goes from 5 to 4 and doesn't touch. The ionic theme also uses a 1px line, so it's probably affected too.
| Before | After |
|---|---|
![]() |
![]() |
![]() |
![]() |
Could the item reserve the line's thickness at the bottom, for example with padding on .item-native/.item-inner equal to the line, so the height and spacing stay as before? That would also remove the "an item with a line is slightly shorter" note from BREAKING.md.
There was a problem hiding this comment.
Done in 3c0a98b. In every theme, the item keeps the line's thickness as bottom padding on .item-native (full) or .item-inner (inset), so heights and spacing match ionic-modular again, and the "slightly shorter" note is gone. I measured item, list and accordion heights in WebKit at 2x and 3x against the ionic-modular preview, and they match. The ios accordion keeps its top line's space as padding on the header, so its height doesn't change either. Hiding a line through its part with display: none now keeps that space, so BREAKING.md says to use lines to hide or show one (559d58e). 4df7fa8 updates the two test pages that hid lines that way.
| } | ||
|
|
||
| // The last accordion's header has no lines (refer to core.scss), so it has no top line either | ||
| :host(.accordion-next:not(.accordion-last)) .accordion-next-line { |
There was a problem hiding this comment.
.accordion-next-line is shown for every :host(.accordion-next:not(.accordion-last)), whatever is slotted into the header. With <button slot="header"> headers and the first accordion expanded, the before preview has no line between Content A and Header B. The after preview shows one. Before, the line came from the header ion-item's border, so non-item headers never had one.
| Before | After |
|---|---|
![]() |
![]() |
Could the line only be shown when the header is an ion-item? The header item is already looked up for the color observer in accordion.tsx, so a host class set at that point would work.
There was a problem hiding this comment.
Done in cebbd00. The accordion adds an accordion-has-header-item class when an ion-item is slotted as the header, and the line only shows with it. A new test checks that the button headers on the basic page have no line, and it fails without the fix.
|
|
||
| // TODO(FW-6865): read only `--ion-color-${color}-bold-shade` once the | ||
| // old color token is gone, along with the same fallback in `generateColorClasses` | ||
| nextLineEl.style.color = `var(--ion-color-${color}-shade, var(--ion-color-${color}-bold-shade))`; |
There was a problem hiding this comment.
ionColor(color, 'shade') from the theme utils already builds this fallback chain, so it could be used instead of the hand-written string.
| return dppx ? `${query}, (-webkit-${range}-device-pixel-ratio: ${dppx[1]})` : query; | ||
| }; | ||
|
|
||
| const isObject = (value: unknown): value is Record<string, unknown> => |
There was a problem hiding this comment.
This is the same check as isPlainObject in breakpoints.ts. Could that one be exported and reused here instead of adding a second copy?
| * The recipe key that holds the values a component uses inside media queries. | ||
| * Its path builds the query: `min.resolution['2dppx']` becomes | ||
| * `(min-resolution: 2dppx)`. The values set the same variables as the | ||
| * component's own, so unlike a state, the key is left out of the variable names: |
There was a problem hiding this comment.
Could this drop "unlike a state"? The sentence still explains the behavior without the comparison:
| * component's own, so unlike a state, the key is left out of the variable names: | |
| * component's own, so the key is left out of the variable names: |
|
|
||
| :host(.accordion-next) ::slotted(ion-item[slot="header"]) { | ||
| --border-width: #{$item-ios-border-bottom-width 0px $item-ios-border-bottom-width 0px}; | ||
| // Drawn as a filled box instead of a border on the header item |
There was a problem hiding this comment.
"Drawn as a filled box instead of a border" explains the code by what it replaced. Something like this says why it exists:
| // Drawn as a filled box instead of a border on the header item | |
| // Drawn as a filled box so it stays visible at sub-pixel positions in WebKit |
The same applies to item/item.common.scss:293 and divider/divider.scss:41.
| // it does in the app (refer to `mergeTheme`). | ||
| if (customTheme) { | ||
| theme = deepMerge(theme, customTheme); | ||
| theme = themeUtils.mergeTheme(theme, customTheme); |
There was a problem hiding this comment.
This was the only call to the deepMerge defined at line 197, which is scoped inside the IIFE, so nothing else can reach it now. Can that function be removed along with its TODO?
Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>






Issue number: resolves #30772
What is the current behavior?
On iOS, WebKit skips borders thinner than one CSS pixel at some positions on the page, so the 0.55px line between items disappears while scrolling.
What is the new behavior?
hairlinemixin that draws a line as a filled box along a top or bottom edge instead of a border. Without a thickness, it is one screen pixel thick at 1x, 2x and 3x.mediaQueryrecipe key: values undermediaQuery.min.resolutionset the same variable inside a media query. A value a custom theme sets replaces the base theme's media query values for that key, so it applies on every screen.ion-dividerdraws its line with the mixin, and the ios theme sets it to one screen pixel at each density.ion-itemdraws its full and inset lines with the mixin in every theme, as thelineandinner-lineparts. The item keeps the space the border took, so heights don't change. The ios theme sets them to one screen pixel at each density.colorwhen it has one.Does this introduce a breaking change?
In every theme:
--border-widthand--inner-border-widthno longer draw the lines between items. Uselines="none"to hide a line, or style it withion-item::part(line)(full width) orion-item::part(inner-line)(inset).--border-colorstill sets the line color.display: nonekeeps the space below it.lines="none"removes both.In the ios theme:
--border-coloron an accordion's header item no longer changes the line above it.Other information
Known gaps
thicknessonly shows on 1x screens.How to test
Lines draw one screen pixel thick, with none missing, in Safari on the iOS 17.5 and 26.2 simulators at every position the hairlines page reaches.
Lines look lighter than before in desktop browsers and in Chrome's device toolbar. Those drew the old 0.55px border two screen pixels thick, and the new line is one screen pixel, which is what iPhones always drew.
core/src/components/item/test/hairlines/index.htmlonnextand runnpm start