File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -152,12 +152,8 @@ export class TabContainerElement extends HTMLElement {
152152
153153 this . addEventListener ( 'keydown' , this )
154154 this . addEventListener ( 'click' , this )
155- this . selectTab (
156- Math . max (
157- this . #tabs. findIndex ( el => el . matches ( '[aria-selected=true]' ) ) ,
158- 0 ,
159- ) ,
160- )
155+
156+ this . selectTab ( - 1 )
161157 this . #setupComplete = true
162158 }
163159
@@ -257,6 +253,8 @@ export class TabContainerElement extends HTMLElement {
257253 this . #beforeTabsSlot. assign ( ...beforeSlotted )
258254 this . #afterTabsSlot. assign ( ...afterTabSlotted )
259255 this . #afterPanelsSlot. assign ( ...afterSlotted )
256+ const defaultIndex = this . #tabs. findIndex ( el => el . matches ( '[aria-selected=true]' ) )
257+ index = index >= 0 ? index : Math . max ( 0 , defaultIndex )
260258 }
261259
262260 const tabs = this . #tabs
You can’t perform that action at this time.
0 commit comments