@@ -172,6 +172,17 @@ export class PfeJumpLinksNav extends LitElement {
172172
173173 private slots = new SlotController ( this , 'heading' , 'logo' , 'cta' ) ;
174174
175+ /** Sets aria-labelledby on incoming ul and ol nodes */
176+ private ariaMO = new MutationObserver ( records => {
177+ for ( const record of records ) {
178+ for ( const node of record . addedNodes ) {
179+ if ( node instanceof HTMLOListElement || node instanceof HTMLUListElement ) {
180+ node . setAttribute ( 'aria-labelledby' , 'heading' ) ;
181+ }
182+ }
183+ }
184+ } ) ;
185+
175186 /**
176187 * @requires {this.mobileBreakpoint || LitElement.breakpoint}
177188 * @returns true if this is at or below the mobile breakpoint
@@ -431,9 +442,11 @@ export class PfeJumpLinksNav extends LitElement {
431442 render ( ) {
432443 const content = html `
433444 < nav part ="nav "> ${ this . isMobile ? '' : html `
434- < slot name ="heading " class ="pfe-jump-links-nav__heading " ?sr-only =${ this . noHeader } >
435- < h3 > ${ this . srText || 'Jump to section' } </ h3 >
436- </ slot > ` } ${ ! this . horizontal ? '' : html `
445+ < header id ="heading ">
446+ < slot name ="heading " class ="pfe-jump-links-nav__heading " ?sr-only =${ this . noHeader } >
447+ < h3 > ${ this . srText || 'Jump to section' } </ h3 >
448+ </ slot >
449+ </ header > ` } ${ ! this . horizontal ? '' : html `
437450 < slot name ="logo " class ="pfe-jump-links-nav__logo "> </ slot > ` }
438451 < div id ="container " part ="content "> ${ unsafeHTML ( this . containerInnerHTML ) } </ div > ${ ! this . horizontal ? '' : html `
439452 < slot name ="cta " class ="pfe-jump-links-nav__cta "> </ slot > ` }
@@ -442,7 +455,7 @@ export class PfeJumpLinksNav extends LitElement {
442455
443456 return ! this . isMobile ? content : html `
444457 < pfe-accordion >
445- < pfe-accordion-header >
458+ < pfe-accordion-header id =" heading " >
446459 < slot name ="heading " class ="pfe-jump-links-nav__heading ">
447460 < h3 > ${ this . srText || 'Jump to section' } </ h3 >
448461 </ slot >
@@ -453,6 +466,9 @@ export class PfeJumpLinksNav extends LitElement {
453466 }
454467
455468 firstUpdated ( ) {
469+ if ( this . container ) {
470+ this . ariaMO . observe ( this . container , { childList : true } ) ;
471+ }
456472 this . _scrollHandler ( ) ;
457473 // Capture the updated UL tag
458474 const menu = this . querySelector < HTMLElement > ( 'ul, ol' ) ;
0 commit comments