@@ -185,8 +185,8 @@ class PfeAccordion extends PFElement {
185185 headers . forEach ( header => {
186186 const panel = this . _panelForHeader ( header ) ;
187187
188- header . setAttribute ( "aria-controls" , panel . id ) ;
189- panel . setAttribute ( "aria-labelledby" , header . id ) ;
188+ header . setAttribute ( "aria-controls" , panel . pfeId ) ;
189+ panel . setAttribute ( "aria-labelledby" , header . pfeId ) ;
190190 } ) ;
191191 }
192192
@@ -356,6 +356,18 @@ class PfeAccordionHeader extends PFElement {
356356 return "pfe-accordion-header.html" ;
357357 }
358358
359+ get pfeId ( ) {
360+ return this . getAttribute ( "pfe-id" ) ;
361+ }
362+
363+ set pfeId ( id ) {
364+ if ( ! id ) {
365+ return ;
366+ }
367+
368+ this . setAttribute ( "pfe-id" , id ) ;
369+ }
370+
359371 static get observedAttributes ( ) {
360372 return [ "aria-expanded" ] ;
361373 }
@@ -372,8 +384,8 @@ class PfeAccordionHeader extends PFElement {
372384 this . setAttribute ( "role" , "header" ) ;
373385 }
374386
375- if ( ! this . id ) {
376- this . id = `${ PfeAccordionHeader . tag } -${ generateId ( ) } ` ;
387+ if ( ! this . pfeId ) {
388+ this . pfeId = `${ PfeAccordionHeader . tag } -${ generateId ( ) } ` ;
377389 }
378390
379391 this . button = this . shadowRoot . querySelector ( "button" ) ;
@@ -456,6 +468,18 @@ class PfeAccordionPanel extends PFElement {
456468 return "pfe-accordion-panel.html" ;
457469 }
458470
471+ get pfeId ( ) {
472+ return this . getAttribute ( "pfe-id" ) ;
473+ }
474+
475+ set pfeId ( id ) {
476+ if ( ! id ) {
477+ return ;
478+ }
479+
480+ this . setAttribute ( "pfe-id" , id ) ;
481+ }
482+
459483 constructor ( ) {
460484 super ( PfeAccordionPanel ) ;
461485 }
@@ -467,8 +491,8 @@ class PfeAccordionPanel extends PFElement {
467491 this . setAttribute ( "role" , "region" ) ;
468492 }
469493
470- if ( ! this . id ) {
471- this . id = `${ PfeAccordionPanel . tag } -${ generateId ( ) } ` ;
494+ if ( ! this . pfeId ) {
495+ this . pfeId = `${ PfeAccordionPanel . tag } -${ generateId ( ) } ` ;
472496 }
473497 }
474498
0 commit comments