fix: changed selectors for invokers and content to only select slotted elements that are direct descendants. This is to prevent that slotted elements in accordion content and invokers are also selected and the amount of invokers and content is incorrect
This commit is contained in:
parent
ecea06cb6e
commit
3f1c83a180
2 changed files with 7 additions and 2 deletions
5
.changeset/silly-beds-teach.md
Normal file
5
.changeset/silly-beds-teach.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@lion/ui': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
lion-accordion: changed selectors for invokers and content to only select slotted elements that are direct descendants. This is to prevent that slotted elements in accordion content and invokers are also selected and the amount of invokers and content is incorrect
|
||||||
|
|
@ -171,12 +171,12 @@ export class LionAccordion extends LitElement {
|
||||||
|
|
||||||
const invokers = /** @type {HTMLElement[]} */ ([
|
const invokers = /** @type {HTMLElement[]} */ ([
|
||||||
...Array.from(existingInvokers),
|
...Array.from(existingInvokers),
|
||||||
...Array.from(this.querySelectorAll('[slot="invoker"]')),
|
...Array.from(this.querySelectorAll(':scope > [slot="invoker"]')),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const contents = /** @type {HTMLElement[]} */ ([
|
const contents = /** @type {HTMLElement[]} */ ([
|
||||||
...Array.from(existingContent),
|
...Array.from(existingContent),
|
||||||
...Array.from(this.querySelectorAll('[slot="content"]')),
|
...Array.from(this.querySelectorAll(':scope > [slot="content"]')),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (invokers.length !== contents.length) {
|
if (invokers.length !== contents.length) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue