1- import type { ReactiveController , ReactiveControllerHost } from 'lit' ;
1+ import { isServer , type ReactiveController , type ReactiveControllerHost } from 'lit' ;
22
33import { Logger } from '@patternfly/pfe-core/controllers/logger.js' ;
44
@@ -19,7 +19,7 @@ export class TabsAriaController<
1919
2020 #host: ReactiveControllerHost ;
2121
22- #element: HTMLElement ;
22+ #element! : HTMLElement ;
2323
2424 #tabPanelMap = new Map < Tab , Panel > ( ) ;
2525
@@ -52,6 +52,10 @@ export class TabsAriaController<
5252 ) {
5353 this . #options = options ;
5454 this . #logger = new Logger ( host ) ;
55+ ( this . #host = host ) . addController ( this ) ;
56+ if ( isServer ) {
57+ return ;
58+ }
5559 if ( host instanceof HTMLElement ) {
5660 this . #element = host ;
5761 } else {
@@ -63,7 +67,6 @@ export class TabsAriaController<
6367 }
6468 this . #element = element ;
6569 }
66- ( this . #host = host ) . addController ( this ) ;
6770 this . #element. addEventListener ( 'slotchange' , this . #onSlotchange) ;
6871 if ( this . #element. isConnected ) {
6972 this . hostConnected ( ) ;
@@ -93,7 +96,7 @@ export class TabsAriaController<
9396 this . #tabPanelMap. clear ( ) ;
9497 const tabs = [ ] ;
9598 const panels = [ ] ;
96- for ( const child of this . #element. children ) {
99+ for ( const child of this . #element? .children ?? [ ] ) {
97100 if ( this . #options. isTab ( child ) ) {
98101 tabs . push ( child ) ;
99102 child . role ??= 'tab' ;
0 commit comments