Skip to content

Commit 708364d

Browse files
fix(sheet): fix toolbar not showing contents in ios for ionic theme (#30496)
Issue number: resolves internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? The `ion-toolbar` contents inside the `sheet` were not being displayed correctly in `iOS`. ## What is the new behavior? This PR add `z-index` values of the `ion-toolbar`'s `content` and `background` containers to fix the issue. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information Before: <img src="https://github.com/user-attachments/assets/ac28e3de-9bb3-447d-a6f7-cce40ccd222c" alt="Sample Image" height="300"> After: <img src="https://github.com/user-attachments/assets/18af1b57-dd70-4783-b0e7-9fffab8402a3" alt="Sample Image" height="300"> --------- Co-authored-by: ionitron <hi@ionicframework.com>
1 parent 5da9cc6 commit 708364d

File tree

87 files changed

+66
-32
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+66
-32
lines changed

core/src/components/modal/test/sheet/modal.e2e.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
import { expect } from '@playwright/test';
22
import { configs, test, dragElementBy } from '@utils/test/playwright';
33

4-
configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
5-
test.describe(title('sheet modal: rendering'), () => {
6-
test('should not have visual regressions', async ({ page }) => {
7-
await page.goto('/src/components/modal/test/sheet', config);
8-
const ionModalDidPresent = await page.spyOnEvent('ionModalDidPresent');
4+
configs({ modes: ['ios', 'md', 'ionic-ios', 'ionic-md'], directions: ['ltr'] }).forEach(
5+
({ title, screenshot, config }) => {
6+
test.describe(title('sheet modal: rendering'), () => {
7+
test('should not have visual regressions', async ({ page }) => {
8+
await page.goto('/src/components/modal/test/sheet', config);
9+
const ionModalDidPresent = await page.spyOnEvent('ionModalDidPresent');
910

10-
await page.click('#sheet-modal');
11+
await page.click('#sheet-modal');
1112

12-
await ionModalDidPresent.next();
13+
await ionModalDidPresent.next();
1314

14-
await expect(page).toHaveScreenshot(screenshot(`modal-sheet-present`), {
15-
/**
16-
* Animations must be enabled to capture the screenshot.
17-
* By default, animations are disabled with toHaveScreenshot,
18-
* and when capturing the screenshot will call animation.finish().
19-
* This will cause the modal to close and the screenshot capture
20-
* to be invalid.
21-
*/
22-
animations: 'allow',
15+
await expect(page).toHaveScreenshot(screenshot(`modal-sheet-present`), {
16+
/**
17+
* Animations must be enabled to capture the screenshot.
18+
* By default, animations are disabled with toHaveScreenshot,
19+
* and when capturing the screenshot will call animation.finish().
20+
* This will cause the modal to close and the screenshot capture
21+
* to be invalid.
22+
*/
23+
animations: 'allow',
24+
});
2325
});
2426
});
25-
});
26-
});
27+
}
28+
);
2729

2830
configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
2931
test.describe(title('sheet modal: half screen rendering'), () => {
@@ -62,7 +64,7 @@ configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screensh
6264
});
6365
});
6466

65-
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
67+
configs({ modes: ['ios', 'ionic-ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
6668
test.describe(title('sheet modal: backdrop'), () => {
6769
test.beforeEach(async ({ page }) => {
6870
await page.goto('/src/components/modal/test/sheet', config);
@@ -175,7 +177,7 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
175177
const ionBreakpointDidChange = await page.spyOnEvent('ionBreakpointDidChange');
176178
const header = page.locator('.modal-sheet ion-header');
177179

178-
await dragElementBy(header, page, 0, 125);
180+
await dragElementBy(header, page, 0, 110);
179181

180182
await ionBreakpointDidChange.next();
181183

core/src/components/toolbar/test/basic/toolbar.e2e.ts

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
import { expect } from '@playwright/test';
22
import { configs, test } from '@utils/test/playwright';
33

4-
configs({ palettes: ['light', 'dark'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
5-
test.describe(title('toolbar: basic (LTR only)'), () => {
6-
test('should not have visual regressions with text only', async ({ page }) => {
7-
await page.setContent(
8-
`
4+
configs({ modes: ['ios', 'md', 'ionic-md'], palettes: ['light', 'dark'], directions: ['ltr'] }).forEach(
5+
({ title, screenshot, config }) => {
6+
test.describe(title('toolbar: basic (LTR only)'), () => {
7+
test('should not have visual regressions with text only', async ({ page }) => {
8+
await page.setContent(
9+
`
910
<ion-header>
1011
<ion-toolbar>
1112
<ion-title>Toolbar</ion-title>
1213
</ion-toolbar>
1314
</ion-header>
1415
`,
15-
config
16-
);
16+
config
17+
);
1718

18-
const header = page.locator('ion-header');
19-
await expect(header).toHaveScreenshot(screenshot(`toolbar-basic-text-only`));
19+
const header = page.locator('ion-header');
20+
await expect(header).toHaveScreenshot(screenshot(`toolbar-basic-text-only`));
21+
});
2022
});
21-
});
22-
});
23+
}
24+
);
2325

24-
configs({ palettes: ['light', 'dark'] }).forEach(({ title, screenshot, config }) => {
26+
configs({ modes: ['ios', 'md', 'ionic-md'], palettes: ['light', 'dark'] }).forEach(({ title, screenshot, config }) => {
2527
test.describe(title('toolbar: basic'), () => {
2628
test('should truncate long title with ellipsis', async ({ page }) => {
2729
await page.setContent(
@@ -156,5 +158,25 @@ configs({ palettes: ['light', 'dark'] }).forEach(({ title, screenshot, config })
156158
const header = page.locator('ion-header');
157159
await expect(header).toHaveScreenshot(screenshot(`toolbar-basic-text-icon-buttons`));
158160
});
161+
162+
test('should not have visual regressions with text and button inside the content slot', async ({ page }) => {
163+
await page.setContent(
164+
`
165+
<ion-header>
166+
<ion-toolbar>
167+
<ion-button fill="solid">
168+
<ion-icon slot="start" name="person-circle"></ion-icon>
169+
Solid
170+
</ion-button>
171+
<span>Solid</span>
172+
</ion-toolbar>
173+
</ion-header>
174+
`,
175+
config
176+
);
177+
178+
const header = page.locator('ion-header');
179+
await expect(header).toHaveScreenshot(screenshot(`toolbar-basic-text-buttons-inside-content`));
180+
});
159181
});
160182
});

core/src/components/toolbar/toolbar.ionic.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717

1818
.toolbar-container {
1919
gap: globals.$ion-space-400;
20+
// TODO(ROU-10853): replace this value with a layer token
21+
z-index: 10;
22+
}
23+
24+
// Toolbar: Transparent
25+
// --------------------------------------------------
26+
27+
.toolbar-background {
28+
// TODO(ROU-10853): replace this value with a layer token
29+
z-index: -1;
2030
}
2131

2232
// Toolbar: Content

0 commit comments

Comments
 (0)