File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import { SiResizeObserverModule } from '@siemens/element-ng/resize-observer';
2929import { SiTabBadgeComponent } from './si-tab-badge.component' ;
3030import { SiTabBaseDirective } from './si-tab-base.directive' ;
3131import { SiTabLinkComponent } from './si-tab-link.component' ;
32+ import { SiTabComponent } from './si-tab.component' ;
3233import { SI_TABSET } from './si-tabs-tokens' ;
3334
3435/**
@@ -94,6 +95,16 @@ export class SiTabsetComponent {
9495 }
9596
9697 constructor ( ) {
98+ // Per the ARIA tabs pattern, at least one tab should be active. If the app
99+ // does not provide an active tab, activate the first non-disabled content
100+ // tab so the tablist stays keyboard reachable.
101+ effect ( ( ) => {
102+ const tabs = this . tabPanels ( ) ;
103+ if ( tabs . length && ! tabs . some ( tab => tab . active ( ) ) ) {
104+ tabs . find ( tab => tab instanceof SiTabComponent && ! tab . disabledTab ( ) ) ?. selectTab ( ) ;
105+ }
106+ } ) ;
107+
97108 effect ( ( ) => {
98109 if ( this . showMenuButton ( ) && this . activeTab ( ) ) {
99110 // wait for menu button to render on DOM
You can’t perform that action at this time.
0 commit comments