diff --git a/core/src/components/action-sheet/action-sheet.scss b/core/src/components/action-sheet/action-sheet.scss index 460c91a8cc4..b6b91e73309 100644 --- a/core/src/components/action-sheet/action-sheet.scss +++ b/core/src/components/action-sheet/action-sheet.scss @@ -128,8 +128,8 @@ height: 100%; /* Fallback for browsers that do not support dvh */ - max-height: 100vh; - max-height: 100dvh; + max-height: calc(100vh - (var(--ion-safe-area-top, 0) + var(--ion-safe-area-bottom, 0))); + max-height: calc(100dvh - (var(--ion-safe-area-top, 0) + var(--ion-safe-area-bottom, 0))); } .action-sheet-group { diff --git a/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts index d422c55247d..d0921d354da 100644 --- a/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts +++ b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts @@ -100,3 +100,69 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ config, title }) => }); }); }); + +/** + * This behavior needs to be tested in both modes but does not vary + * across directions due to the component only applying safe area + * to the top and bottom + */ +configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { + test.describe(title('action-sheet: basic'), () => { + test.describe('safe area', () => { + test('should have padding added by the safe area', async ({ page }, testInfo) => { + testInfo.annotations.push({ + type: 'issue', + description: 'https://github.com/ionic-team/ionic-framework/issues/27777', + }); + await page.setContent( + ` + + + + + + `, + config + ); + + const ionActionSheetDidPresent = await page.spyOnEvent('ionActionSheetDidPresent'); + const actionSheet = page.locator('ion-action-sheet'); + + await actionSheet.evaluate((el: HTMLIonActionSheetElement) => el.present()); + await ionActionSheetDidPresent.next(); + + await expect(actionSheet).toHaveScreenshot(screenshot(`action-sheet-safe-area`)); + }); + }); + }); +}); diff --git a/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..25414ea6491 Binary files /dev/null and b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..f5650d94c8e Binary files /dev/null and b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-ios-ltr-Mobile-Safari-linux.png b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..f4006b17665 Binary files /dev/null and b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-md-ltr-Mobile-Chrome-linux.png b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..1106fcc5839 Binary files /dev/null and b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-md-ltr-Mobile-Firefox-linux.png b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..03b1f618c3a Binary files /dev/null and b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-md-ltr-Mobile-Safari-linux.png b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..5abd5f6823f Binary files /dev/null and b/core/src/components/action-sheet/test/basic/action-sheet.e2e.ts-snapshots/action-sheet-safe-area-md-ltr-Mobile-Safari-linux.png differ