Skip to content

Commit

Permalink
fix(tab-nav): update indicator position when tab icon changes. #6821
Browse files Browse the repository at this point in the history
  • Loading branch information
driskull committed Sep 19, 2023
1 parent f4fb2f6 commit 2b16600
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export class TabNav {
@Listen("calciteInternalTabIconChanged")
iconStartChangeHandler(): void {
this.updateActiveWidth();
this.updateOffsetPosition();
}

//--------------------------------------------------------------------------
Expand Down
19 changes: 19 additions & 0 deletions packages/calcite-components/src/components/tabs/tabs.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,22 @@ export const TabChildrenWithPercentageHeights = (): string => html`
TabChildrenWithPercentageHeights.parameters = {
chromatic: { delay: 1000 },
};

export const updateIndicatorOffset_TestOnly = (): string => html`<calcite-tabs>
<calcite-tab-nav slot="title-group">
<calcite-tab-title id="tab-title">Boats</calcite-tab-title>
<calcite-tab-title selected>Ships</calcite-tab-title>
<calcite-tab-title>Yachts</calcite-tab-title>
</calcite-tab-nav>
<calcite-tab>Tab 1 content</calcite-tab>
<calcite-tab>Tab 2 content</calcite-tab>
<calcite-tab>Tab 3 content</calcite-tab>
</calcite-tabs>
<script>
const tabTitle = document.getElementById("tab-title");
setTimeout(() => (tabTitle.iconStart = "bullet-point"), 300);
</script>`;

updateIndicatorOffset_TestOnly.parameters = {
chromatic: { delay: 1000 },
};

0 comments on commit 2b16600

Please sign in to comment.