diff --git a/core/src/components/list-header/list-header.ios.scss b/core/src/components/list-header/list-header.ios.scss index 81fbcddfdef..c299612af7b 100644 --- a/core/src/components/list-header/list-header.ios.scss +++ b/core/src/components/list-header/list-header.ios.scss @@ -9,7 +9,17 @@ --color: #{$list-header-ios-color}; --border-color: #{$item-ios-border-bottom-color}; - @include padding-horizontal(calc(var(--ion-safe-area-left, 0px) + #{$list-header-ios-padding-start}), null); + /* stylelint-disable */ + @include ltr() { + padding-right: var(--ion-safe-area-right); + padding-left: calc(var(--ion-safe-area-left, 0px) + #{$list-header-ios-padding-start}); + } + + @include rtl() { + padding-right: calc(var(--ion-safe-area-right, 0px) + #{$list-header-ios-padding-start}); + padding-left: var(--ion-safe-area-left); + } + /* stylelint-enable */ position: relative; diff --git a/core/src/components/list-header/list-header.md.scss b/core/src/components/list-header/list-header.md.scss index 6f1f7d92c58..05e83a759c0 100644 --- a/core/src/components/list-header/list-header.md.scss +++ b/core/src/components/list-header/list-header.md.scss @@ -9,7 +9,17 @@ --color: #{$list-header-md-color}; --border-color: #{$item-md-border-bottom-color}; - @include padding-horizontal(calc(var(--ion-safe-area-left, 0) + #{$list-header-md-padding-start}), null); + /* stylelint-disable */ + @include ltr() { + padding-right: var(--ion-safe-area-right); + padding-left: calc(var(--ion-safe-area-left, 0px) + #{$list-header-md-padding-start}); + } + + @include rtl() { + padding-right: calc(var(--ion-safe-area-right, 0px) + #{$list-header-md-padding-start}); + padding-left: var(--ion-safe-area-left); + } + /* stylelint-enable */ min-height: $list-header-md-min-height; diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts b/core/src/components/list-header/test/basic/list-header.e2e.ts index 25e61cbe0ff..29fdf9e44de 100644 --- a/core/src/components/list-header/test/basic/list-header.e2e.ts +++ b/core/src/components/list-header/test/basic/list-header.e2e.ts @@ -12,3 +12,37 @@ configs().forEach(({ title, screenshot, config }) => { }); }); }); + +/** + * This behavior needs to be tested in both modes and directions to + * make sure the safe area padding is applied only to that side + * regardless of direction + */ +configs().forEach(({ title, screenshot, config }) => { + test.describe(title('list-header: basic'), () => { + test.describe('safe area', () => { + test('should have padding added by the safe area', async ({ page }) => { + await page.setContent( + ` + + + + List Header + Button + + `, + config + ); + + const listHeader = page.locator('ion-list-header'); + + await expect(listHeader).toHaveScreenshot(screenshot(`list-header-safe-area`)); + }); + }); + }); +}); diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..cd427c006a4 Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..19c3d281dd1 Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-ltr-Mobile-Safari-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..9aea2540a9d Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-rtl-Mobile-Chrome-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-rtl-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..c0c9ab7ac37 Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-rtl-Mobile-Chrome-linux.png differ diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-rtl-Mobile-Firefox-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-rtl-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..47662d96c2f Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-rtl-Mobile-Firefox-linux.png differ diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-rtl-Mobile-Safari-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-rtl-Mobile-Safari-linux.png new file mode 100644 index 00000000000..e82f1090c96 Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-ios-rtl-Mobile-Safari-linux.png differ diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-ltr-Mobile-Chrome-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..6e6c1cd3254 Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-ltr-Mobile-Firefox-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..ed07537b265 Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-ltr-Mobile-Safari-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..24de281dbae Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-rtl-Mobile-Chrome-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-rtl-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..aaedcccefe9 Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-rtl-Mobile-Chrome-linux.png differ diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-rtl-Mobile-Firefox-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-rtl-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..d8e9d57599f Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-rtl-Mobile-Firefox-linux.png differ diff --git a/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-rtl-Mobile-Safari-linux.png b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-rtl-Mobile-Safari-linux.png new file mode 100644 index 00000000000..b6de2cc78bc Binary files /dev/null and b/core/src/components/list-header/test/basic/list-header.e2e.ts-snapshots/list-header-safe-area-md-rtl-Mobile-Safari-linux.png differ