addTriggers(toggleTriggers) {
        toggleTriggers.forEach((trigger) => {
            const parentId = trigger.getAttribute('aria-label');
            const parent = trigger.parentElement;

            trigger.addEventListener('click', () => {

                const ariaPressed = (trigger.getAttribute('aria-pressed') === 'true') ? 'false' : 'true';
                trigger.setAttribute('aria-pressed', ariaPressed);
                
                if (!trigger.getAttribute('aria-loaded')) {
                    trigger.setAttribute('aria-loaded', 'true');
                    this.appendChildren(parentId).then((child) => {
                        parent.appendChild(child);
                        
                        const parentSubcontainer = parent.querySelector('.c-sidebar__subcontainer');

                        this.addTriggers(parentSubcontainer.querySelectorAll('.c-sidebar__toggle'));
                    });
                }

                const parentSubcontainer = parent.querySelector('.c-sidebar__subcontainer');

                if(parentSubcontainer) {
                    parentSubcontainer.classList.toggle('c-sidebar__item--is-expanded');
                }

            });
            
        });
    }
/**
     * Adds listeners to buttons
     * @param {Object} sb The sidebar
    */
Adds listeners to buttons
@param {Object} sb The sidebar
Adds listeners to buttons @param { Object } sb The sidebar
addTriggers(toggleTriggers) {
        toggleTriggers.forEach((trigger) => {
            const parentId = trigger.getAttribute('aria-label');
            const parent = trigger.parentElement;
            trigger.addEventListener('click', () => {
                const ariaPressed = (trigger.getAttribute('aria-pressed') === 'true') ? 'false' : 'true';
                trigger.setAttribute('aria-pressed', ariaPressed);
                if (!trigger.getAttribute('aria-loaded')) {
                    trigger.setAttribute('aria-loaded', 'true');
                    this.appendChildren(parentId).then((child) => {
                        parent.appendChild(child);
                        const parentSubcontainer = parent.querySelector('.c-sidebar__subcontainer');
                        this.addTriggers(parentSubcontainer.querySelectorAll('.c-sidebar__toggle'));
                    });
                }
                const parentSubcontainer = parent.querySelector('.c-sidebar__subcontainer');
                if(parentSubcontainer) {
                    parentSubcontainer.classList.toggle('c-sidebar__item--is-expanded');
                }
            });
        });
    }
addTriggers ( toggleTriggers ) { toggleTriggers . forEach ( ( trigger ) => { const parentId = trigger . getAttribute ( 'aria-label' ) ; const parent = trigger . parentElement ; trigger . addEventListener ( 'click' , ( ) => { const ariaPressed = ( trigger . getAttribute ( 'aria-pressed' ) === 'true' ) ? 'false' : 'true' ; trigger . setAttribute ( 'aria-pressed' , ariaPressed ) ; if ( ! trigger . getAttribute ( 'aria-loaded' ) ) { trigger . setAttribute ( 'aria-loaded' , 'true' ) ; this . appendChildren ( parentId ) . then ( ( child ) => { parent . appendChild ( child ) ; const parentSubcontainer = parent . querySelector ( '.c-sidebar__subcontainer' ) ; this . addTriggers ( parentSubcontainer . querySelectorAll ( '.c-sidebar__toggle' ) ) ; } ) ; } const parentSubcontainer = parent . querySelector ( '.c-sidebar__subcontainer' ) ; if ( parentSubcontainer ) { parentSubcontainer . classList . toggle ( 'c-sidebar__item--is-expanded' ) ; } } ) ; } ) ; }
Adds listeners to buttons
 @param {Object} sb The sidebar
Adds listeners to buttons @param { Object } sb The sidebar