@@ -288,6 +288,7 @@ export const DashboardItemMixin = (superClass) =>
288288 super ( ) ;
289289 this . __keyboardController = new KeyboardController ( this ) ;
290290 this . __focusTrapController = new FocusTrapController ( this ) ;
291+ this . __boundRootHeadingLevelChangedListener = this . __updateRootHeadingLevel . bind ( this ) ;
291292 }
292293
293294 /** @protected */
@@ -401,19 +402,22 @@ export const DashboardItemMixin = (superClass) =>
401402 this . __removeHeadingLevelObserver ( ) ;
402403 const parentLayout = getParentLayout ( this ) ;
403404 if ( parentLayout ) {
404- this . __headingLevelObserver = new MutationObserver ( ( ) => this . __updateRootHeadingLevel ( ) ) ;
405- this . __headingLevelObserver . observe ( parentLayout , {
406- attributes : true ,
407- attributeFilter : [ 'root-heading-level' ] ,
408- } ) ;
405+ this . __rootHeadingLevelListenerTarget = parentLayout ;
406+ parentLayout . addEventListener (
407+ 'dashboard-root-heading-level-changed' ,
408+ this . __boundRootHeadingLevelChangedListener ,
409+ ) ;
409410 }
410411 }
411412
412413 /** @private */
413414 __removeHeadingLevelObserver ( ) {
414- if ( this . __headingLevelObserver ) {
415- this . __headingLevelObserver . disconnect ( ) ;
416- this . __headingLevelObserver = null ;
415+ if ( this . __rootHeadingLevelListenerTarget ) {
416+ this . __rootHeadingLevelListenerTarget . removeEventListener (
417+ 'dashboard-root-heading-level-changed' ,
418+ this . __boundRootHeadingLevelChangedListener ,
419+ ) ;
420+ this . __rootHeadingLevelListenerTarget = null ;
417421 }
418422 }
419423
0 commit comments