Skip to content

Commit 39c9694

Browse files
authored
fix(core/toast): increase z-index to display over application overlays (#2014)
1 parent 023cad0 commit 39c9694

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed

.changeset/giant-humans-add.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'@siemens/ix': patch
3+
---
4+
5+
Increase z-index for `toast`s
6+
7+
Fixes #1908

packages/core/scss/_z-index.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@
1414
--theme-z-index-modal: 1050;
1515
--theme-z-index-dropdown: 1060;
1616
--theme-z-index-tooltip: 1070;
17+
--theme-z-index-toast: 1080;
1718
}

packages/core/src/components/toast/styles/toast-container.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
.toast-container {
2424
display: block;
2525
position: fixed;
26+
z-index: var(--theme-z-index-toast);
2627
}
2728

2829
.toast-container--top-right {
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2025 Siemens AG
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
* This source code is licensed under the MIT license found in the
7+
* LICENSE file in the root directory of this source tree.
8+
*/
9+
import { expect } from '@playwright/test';
10+
import { regressionTest } from '@utils/test';
11+
import { toast } from './../../../public-api';
12+
13+
declare global {
14+
interface Window {
15+
toast: typeof toast;
16+
}
17+
}
18+
19+
regressionTest('renders', async ({ mount, page }) => {
20+
await mount('');
21+
22+
await page.evaluate(() => {
23+
window.toast({
24+
message: 'This is a toast message',
25+
});
26+
});
27+
28+
const toast = page.locator('ix-toast');
29+
await expect(toast).toHaveClass(/hydrated/);
30+
await expect(toast).toBeVisible();
31+
});
32+
33+
regressionTest(
34+
'should be visible through overlays',
35+
async ({ mount, page }) => {
36+
await mount(`
37+
<ix-application>
38+
<ix-application-header></ix-application-header>
39+
<ix-menu>
40+
<ix-menu-settings>
41+
</ix-menu-settings>
42+
</ix-menu>
43+
</ix-application>
44+
`);
45+
46+
const settingsButton = page.getByRole('button', { name: 'Settings' });
47+
await settingsButton.click();
48+
49+
// Wait for the menu to be visible
50+
await page.waitForTimeout(500);
51+
52+
await page.evaluate(() => {
53+
window.toast({
54+
message: 'This is a toast message',
55+
});
56+
});
57+
58+
const toast = page.locator('ix-toast');
59+
const closeToast = toast.locator('ix-icon-button');
60+
await expect(toast).toHaveClass(/hydrated/);
61+
62+
await closeToast.click();
63+
await expect(toast).not.toBeVisible();
64+
}
65+
);

packages/core/src/tests/utils/ct/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
defineCustomElements();
2828
</script>
2929

30+
<script type="module">
31+
import { toast } from '/www/build/index.esm.js';
32+
window.toast = toast;
33+
</script>
34+
3035
<title>Stencil Component Starter</title>
3136
<style>
3237
html,

0 commit comments

Comments
 (0)