Skip to content

Commit

Permalink
fix(sbb-tab-group): correctly select a new tab if it is 'active'
Browse files Browse the repository at this point in the history
  • Loading branch information
TomMenga committed Nov 26, 2024
1 parent fe5b0a9 commit 6debe85
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/elements/tabs/tab-group/tab-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ class SbbTabGroupElement extends SbbHydrationMixin(LitElement) {
if (loadedTabs.length) {
loadedTabs.forEach((tab) => this._configure(tab));
this._tabs = this._tabs.concat(loadedTabs);

// If there is an active tab in the new batch, it becomes the new selected
loadedTabs.find((tab) => tab.active)?.tabGroupActions?.select();

Check warning on line 176 in src/elements/tabs/tab-group/tab-group.ts

View check run for this annotation

Codecov / codecov/patch

src/elements/tabs/tab-group/tab-group.ts#L174-L176

Added lines #L174 - L176 were not covered by tests
}
};

Expand Down

0 comments on commit 6debe85

Please sign in to comment.