diff --git a/docs/pages/components/tree.md b/docs/pages/components/tree.md index 65816b8b..efcaf0cd 100644 --- a/docs/pages/components/tree.md +++ b/docs/pages/components/tree.md @@ -7,11 +7,13 @@ layout: component ```html:preview + Deciduous Birch Maple + Field maple Red maple Sugar maple diff --git a/src/components/tree/tree.component.ts b/src/components/tree/tree.component.ts index 78123cca..bfdfc847 100644 --- a/src/components/tree/tree.component.ts +++ b/src/components/tree/tree.component.ts @@ -120,7 +120,7 @@ export default class SlTree extends ShoelaceElement { // Generates a clone of the expand icon element to use for each tree item private getExpandButtonIcon(status: 'expand' | 'collapse') { const slot = status === 'expand' ? this.expandedIconSlot : this.collapsedIconSlot; - const icon = slot.assignedElements({ flatten: true })[0] as HTMLElement; + const icon = slot.assignedElements()[0] as HTMLElement; // Clone it, remove ids, and slot it if (icon) { @@ -140,9 +140,9 @@ export default class SlTree extends ShoelaceElement { item.selectable = this.selection === 'multiple'; ['expand', 'collapse'] - .filter(status => !!this.querySelector(`[slot="${status}-icon"]`)) + .filter(status => !!this.querySelector(`:scope > [slot="${status}-icon"]`)) .forEach((status: 'expand' | 'collapse') => { - const existingIcon = item.querySelector(`[slot="${status}-icon"]`); + const existingIcon = item.querySelector(`:scope > [slot="${status}-icon"]`); if (existingIcon === null) { // No separator exists, add one