Skip to content

Commit db7eac7

Browse files
authored
fix(panel): Correct header and action-bar z-indexing display issues (#7440)
**Related Issue:** #7437 ## Summary - Places action-bar within the header so the z-index isn't an issue anymore - Adjust styles as necessary - Adjust rendering as necessary - Adds screenshot test
1 parent 3dd1e34 commit db7eac7

File tree

4 files changed

+49
-16
lines changed

4 files changed

+49
-16
lines changed

packages/calcite-components/src/components/panel/panel.scss

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,23 @@
2929
}
3030

3131
.header {
32-
@apply bg-foreground-1
33-
w-full
34-
items-stretch
35-
justify-start
32+
@apply bg-foreground-1 flex flex-col
3633
z-header;
34+
}
35+
36+
.header-container {
37+
@apply flex flex-row w-full
38+
items-stretch
39+
justify-start;
3740
flex: 0 0 auto;
3841
}
3942

4043
.action-bar-container {
41-
@apply w-full
42-
z-header;
44+
@apply w-full;
45+
}
46+
47+
.top-separator {
48+
border-block-start: 1px solid var(--calcite-ui-border-3);
4349
}
4450

4551
.bottom-separator {

packages/calcite-components/src/components/panel/panel.stories.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,25 @@ export const actionBarWithoutContent_TestOnly = (): string => html`<calcite-pane
241241
</calcite-action-bar>
242242
</calcite-panel>`;
243243

244+
export const actionBarZIndex_TestOnly = (): string => html`<calcite-panel
245+
style="width: 400px;"
246+
height-scale="s"
247+
menu-open
248+
>
249+
<calcite-action text="banana" text-enabled icon="banana" slot="header-menu-actions"></calcite-action>
250+
<calcite-action text="measure" text-enabled icon="measure" slot="header-menu-actions"></calcite-action>
251+
<calcite-action-bar slot="action-bar">
252+
<calcite-action-group>
253+
<calcite-action text="Add" icon="plus"> </calcite-action>
254+
<calcite-action text="Save" icon="save">
255+
<calcite-tooltip open overlay-positioning="fixed" placement="top" slot="tooltip">test</calcite-tooltip>
256+
</calcite-action>
257+
<calcite-action text="Layers" icon="layers"> </calcite-action>
258+
</calcite-action-group>
259+
</calcite-action-bar>
260+
<p>Some content</p></calcite-panel
261+
>`;
262+
244263
export const footerAndActionBarWithoutContent_TestOnly = (): string => html`<calcite-panel
245264
height-scale="s"
246265
heading="Header!"

packages/calcite-components/src/components/panel/panel.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ export class Panel
195195

196196
@State() effectiveLocale = "";
197197

198+
@State() showHeaderContent = false;
199+
198200
@Watch("effectiveLocale")
199201
effectiveLocaleChange(): void {
200202
updateMessages(this, this.effectiveLocale);
@@ -364,7 +366,7 @@ export class Panel
364366
renderActionBar(): VNode {
365367
return (
366368
<div
367-
class={{ [CSS.actionBarContainer]: true, [CSS.bottomSeparator]: this.hasDefaultContent }}
369+
class={{ [CSS.actionBarContainer]: true, [CSS.topSeparator]: this.showHeaderContent }}
368370
hidden={!this.hasActionBar}
369371
>
370372
<slot name={SLOTS.actionBar} onSlotchange={this.handleActionBarSlotChange} />
@@ -473,23 +475,28 @@ export class Panel
473475

474476
const headerContentNode = this.renderHeaderContent();
475477

476-
const showHeader =
478+
const showHeaderContent =
477479
hasHeaderContent ||
478-
headerContentNode ||
480+
!!headerContentNode ||
479481
hasStartActions ||
480482
hasEndActions ||
481483
closable ||
482484
hasMenuItems;
483485

486+
this.showHeaderContent = showHeaderContent;
487+
484488
return (
485489
<header
486-
class={{ [CSS.header]: true, [CSS.bottomSeparator]: hasDefaultContent || hasActionBar }}
487-
hidden={!showHeader}
490+
class={{ [CSS.header]: true, [CSS.bottomSeparator]: hasDefaultContent }}
491+
hidden={!(showHeaderContent || hasActionBar)}
488492
>
489-
{this.renderHeaderStartActions()}
490-
{this.renderHeaderSlottedContent()}
491-
{headerContentNode}
492-
{this.renderHeaderActionsEnd()}
493+
<div class={CSS.headerContainer} hidden={!showHeaderContent}>
494+
{this.renderHeaderStartActions()}
495+
{this.renderHeaderSlottedContent()}
496+
{headerContentNode}
497+
{this.renderHeaderActionsEnd()}
498+
</div>
499+
{this.renderActionBar()}
493500
</header>
494501
);
495502
}
@@ -559,7 +566,6 @@ export class Panel
559566
ref={this.setContainerRef}
560567
>
561568
{this.renderHeaderNode()}
562-
{this.renderActionBar()}
563569
{this.renderContent()}
564570
{this.renderFooterNode()}
565571
</article>

packages/calcite-components/src/components/panel/resources.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ export const CSS = {
33
backButton: "back-button",
44
container: "container",
55
header: "header",
6+
headerContainer: "header-container",
67
bottomSeparator: "bottom-separator",
8+
topSeparator: "top-separator",
79
heading: "heading",
810
summary: "summary",
911
description: "description",

0 commit comments

Comments
 (0)