diff --git a/src/assets/styles/_floating-ui.scss b/src/assets/styles/_floating-ui.scss index b923b117ff0..63bc23e3563 100644 --- a/src/assets/styles/_floating-ui.scss +++ b/src/assets/styles/_floating-ui.scss @@ -2,10 +2,10 @@ $floating-ui-transform-bottom: translateY(-5px); $floating-ui-transform-top: translateY(5px); $floating-ui-transform-left: translateX(5px); $floating-ui-transform-right: translateX(-5px); -$floating-ui-default-z-index: 900; :root { --calcite-floating-ui-transition: var(--calcite-animation-timing); + --calcite-floating-ui-z-index: theme("zIndex.dropdown"); } @mixin floatingUIAnim { @@ -74,10 +74,10 @@ $floating-ui-default-z-index: 900; } } -@mixin floatingUIContainer($zIndex: $floating-ui-default-z-index) { +@mixin floatingUIContainer() { display: block; position: absolute; - z-index: $zIndex; + z-index: var(--calcite-floating-ui-z-index); } @mixin floatingUIWrapper { @@ -88,9 +88,9 @@ $floating-ui-default-z-index: 900; visibility: visible; } -@mixin floatingUIHost($zIndex: $floating-ui-default-z-index) { +@mixin floatingUIHost() { :host { - @include floatingUIContainer($zIndex); + @include floatingUIContainer(); } @include floatingUIHostAnim(); diff --git a/src/components/combobox/combobox.scss b/src/components/combobox/combobox.scss index 9facac755f3..619b3834620 100644 --- a/src/components/combobox/combobox.scss +++ b/src/components/combobox/combobox.scss @@ -143,6 +143,7 @@ } .floating-ui-container { + --calcite-floating-ui-z-index: theme("zIndex.dropdown"); @include floatingUIContainer(); @include floatingUIWrapper(); } diff --git a/src/components/dropdown/dropdown.scss b/src/components/dropdown/dropdown.scss index e705568f298..e573c7e05e5 100644 --- a/src/components/dropdown/dropdown.scss +++ b/src/components/dropdown/dropdown.scss @@ -13,6 +13,7 @@ @include disabled(); :host .calcite-dropdown-wrapper { + --calcite-floating-ui-z-index: theme("zIndex.dropdown"); @include floatingUIContainer(); @include floatingUIWrapper(); } diff --git a/src/components/input-date-picker/input-date-picker.scss b/src/components/input-date-picker/input-date-picker.scss index dd25472a252..e0783f633eb 100644 --- a/src/components/input-date-picker/input-date-picker.scss +++ b/src/components/input-date-picker/input-date-picker.scss @@ -89,6 +89,7 @@ } .menu-container { + --calcite-floating-ui-z-index: theme("zIndex.dropdown"); @include floatingUIContainer(); @include floatingUIWrapper(); @apply invisible; diff --git a/src/components/modal/modal.stories.ts b/src/components/modal/modal.stories.ts index 4ee8ac1da4f..48cbd61b2a1 100644 --- a/src/components/modal/modal.stories.ts +++ b/src/components/modal/modal.stories.ts @@ -68,3 +68,24 @@ export const darkThemeRTLCustomSize_TestOnly = (): string => html` `; darkThemeRTLCustomSize_TestOnly.parameters = { themes: themesDarkDefault }; + +export const withTooltips_TestOnly = (): string => html` + + Open modal + + +
+ Modal content lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore + et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea + commodo consequat. +
+ Back + + Cancel + Save +
+ Back +`; diff --git a/src/components/popover/popover.scss b/src/components/popover/popover.scss index f782bd7cd16..878a570b1ec 100644 --- a/src/components/popover/popover.scss +++ b/src/components/popover/popover.scss @@ -1,3 +1,15 @@ +/** + * CSS Custom Properties + * + * These properties can be overridden using the component's tag as selector. + * + * @prop --calcite-popover-z-index: Sets the z-index value for the component. + */ + +:host { + --calcite-floating-ui-z-index: var(--calcite-popover-z-index, theme("zIndex.popover")); +} + @include floatingUIHost(); @include floatingUIArrow(); diff --git a/src/components/tooltip/tooltip.e2e.ts b/src/components/tooltip/tooltip.e2e.ts index 5d16fefc6a9..c31e82686af 100644 --- a/src/components/tooltip/tooltip.e2e.ts +++ b/src/components/tooltip/tooltip.e2e.ts @@ -47,7 +47,7 @@ describe("calcite-tooltip", () => { } ])); - it("should have zIndex of 999", async () => { + it("should have zIndex of 901", async () => { const page = await newE2EPage(); await page.setContent( @@ -62,7 +62,7 @@ describe("calcite-tooltip", () => { const style = await tooltip.getComputedStyle(); - expect(style.zIndex).toBe("999"); + expect(style.zIndex).toBe("901"); }); it("tooltip positions when referenceElement is set", async () => { diff --git a/src/components/tooltip/tooltip.scss b/src/components/tooltip/tooltip.scss index 67862f28cef..35d0438f2cf 100644 --- a/src/components/tooltip/tooltip.scss +++ b/src/components/tooltip/tooltip.scss @@ -1,4 +1,16 @@ -@include floatingUIHost(999); +/** + * CSS Custom Properties + * + * These properties can be overridden using the component's tag as selector. + * + * @prop --calcite-tooltip-z-index: Sets the z-index value for the component. + */ + +:host { + --calcite-floating-ui-z-index: var(--calcite-tooltip-z-index, theme("zIndex.tooltip")); +} + +@include floatingUIHost(); @include floatingUIArrow(); .container { diff --git a/tailwind.config.ts b/tailwind.config.ts index 9cc98f3dda6..2b1bca8d8f8 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -218,7 +218,8 @@ export default { dropdown: "600", overlay: "700", modal: "800", - popup: "900" + popover: "900", + tooltip: "901" } } },