Skip to content

Commit 9e6d901

Browse files
authored
fix(tab): prevent vertical scrollbar on content pane when the height of outer elements are specified (#8399)
**Related Issue:** #8139 ## Summary This PR fixes an issue where applying a fixed CSS height on the `calcite-tabs` element or using tabs inside a shell panel caused child `tab`s to sometimes show a vertical scrollbar. --------- Co-authored-by: Erik Harper <[email protected]>
1 parent 89517ea commit 9e6d901

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

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

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
@apply block h-full w-full overflow-auto;
1414
}
1515

16+
.content {
17+
@apply box-border;
18+
}
19+
1620
.scale-s .content {
1721
@apply text-n2h py-1;
1822
}

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

+68
Original file line numberDiff line numberDiff line change
@@ -378,3 +378,71 @@ export const updateIndicatorOffset_TestOnly = (): string => html`<calcite-tabs>
378378
updateIndicatorOffset_TestOnly.parameters = {
379379
chromatic: { delay: 1000 },
380380
};
381+
382+
export const fixedHeightNoVerticalScrollbar_TestOnly = (): string => html`
383+
<calcite-tabs style="height: 400px">
384+
<calcite-tab-nav slot="title-group">
385+
<calcite-tab-title selected> Watercraft </calcite-tab-title>
386+
<calcite-tab-title>Automobiles</calcite-tab-title>
387+
<calcite-tab-title>Aircrafts</calcite-tab-title>
388+
</calcite-tab-nav>
389+
<calcite-tab selected>
390+
<calcite-notice icon="embark" open>
391+
<div slot="message">Recommended for coastal use</div>
392+
</calcite-notice>
393+
<calcite-notice icon="embark" open>
394+
<div slot="message">Why is there a vertical scroll bar in this panel?</div>
395+
</calcite-notice>
396+
</calcite-tab>
397+
<calcite-tab>
398+
<calcite-notice icon="car" open>
399+
<div slot="message">A good choice for inland adventure</div>
400+
</calcite-notice>
401+
<calcite-notice icon="car" open>
402+
<div slot="message">A good choice for inland adventure 2</div>
403+
</calcite-notice>
404+
</calcite-tab>
405+
<calcite-tab>
406+
<calcite-notice icon="plane" open>
407+
<div slot="message">Cross continents quickly</div>
408+
</calcite-notice>
409+
</calcite-tab>
410+
</calcite-tabs>
411+
`;
412+
413+
export const noVerticalScrollbarInsideShellPanel_TestOnly = (): string => html`
414+
<calcite-shell content-behind>
415+
<calcite-shell-panel slot="panel-end" width-scale="l" position="end" display-mode="float">
416+
<calcite-panel heading="Panel with Tabs >> vertical scrollbar">
417+
<calcite-tabs>
418+
<calcite-tab-nav slot="title-group">
419+
<calcite-tab-title selected> Watercraft </calcite-tab-title>
420+
<calcite-tab-title>Automobiles</calcite-tab-title>
421+
<calcite-tab-title>Aircrafts</calcite-tab-title>
422+
</calcite-tab-nav>
423+
<calcite-tab selected>
424+
<calcite-notice icon="embark" open>
425+
<div slot="message">Recommended for coastal use</div>
426+
</calcite-notice>
427+
<calcite-notice icon="embark" open>
428+
<div slot="message">Why is there a vertical scroll bar in this panel?</div>
429+
</calcite-notice>
430+
</calcite-tab>
431+
<calcite-tab>
432+
<calcite-notice icon="car" open>
433+
<div slot="message">A good choice for inland adventure</div>
434+
</calcite-notice>
435+
<calcite-notice icon="car" open>
436+
<div slot="message">A good choice for inland adventure 2</div>
437+
</calcite-notice>
438+
</calcite-tab>
439+
<calcite-tab>
440+
<calcite-notice icon="plane" open>
441+
<div slot="message">Cross continents quickly</div>
442+
</calcite-notice>
443+
</calcite-tab>
444+
</calcite-tabs>
445+
</calcite-panel>
446+
</calcite-shell-panel>
447+
</calcite-shell>
448+
`;

0 commit comments

Comments
 (0)