fix: narrowed the scope of the selectors that query [slot=invoker] and [slot=content] to prevent that any nested elements with [slot=invoker] and [slot=content] are moved to slot=_accordion as well

This commit is contained in:
Danny Moerkerke 2022-12-13 20:13:54 +01:00 committed by Thomas Allmer
parent fafd922251
commit c1fa12fbd2

View file

@ -210,10 +210,10 @@ export class LionAccordion extends LitElement {
*/
__rearrangeInvokersAndContent() {
const invokers = /** @type {HTMLElement[]} */ (
Array.from(this.querySelectorAll('[slot="invoker"]'))
Array.from(this.querySelectorAll(':scope > [slot="invoker"]'))
);
const contents = /** @type {HTMLElement[]} */ (
Array.from(this.querySelectorAll('[slot="content"]'))
Array.from(this.querySelectorAll(':scope > [slot="content"]'))
);
const accordion = this.shadowRoot?.querySelector('slot[name=_accordion]');
if (accordion) {