ignore visually hidden when detecting slots

pull/706/head
Cory LaViska 2022-03-16 17:37:42 -04:00
rodzic afa715c860
commit 3289129782
1 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -18,6 +18,14 @@ export class HasSlotController implements ReactiveController {
if (node.nodeType === node.ELEMENT_NODE) {
const el = node as HTMLElement;
const tagName = el.tagName.toLowerCase();
// Ignore visually hidden elements since they aren't rendered
if (tagName === 'sl-visually-hidden') {
return false;
}
// If it doesn't have a slot attribute, it's part of the default slot
if (!el.hasAttribute('slot')) {
return true;
}