change to getSlottedChildrenOutsideRootElement

This commit is contained in:
konnorrogers
2023-12-01 09:48:02 -05:00
parent 34f306492b
commit 863f3ef3ef

View File

@@ -80,7 +80,7 @@ export function getTabbableBoundary(root: HTMLElement | ShadowRoot) {
* However, there is an edge case when, if the `root` is wrapped by another shadow DOM, it won't grab the children.
* This fixes that fun edge case.
*/
function slotChildrenOutsideRootElement(slotElement: HTMLSlotElement, root: HTMLElement | ShadowRoot) {
function getSlottedChildrenOutsideRootElement(slotElement: HTMLSlotElement, root: HTMLElement | ShadowRoot) {
return (slotElement.getRootNode({ composed: true }) as ShadowRoot | null)?.host !== root;
}
@@ -104,7 +104,7 @@ export function getTabbableElements(root: HTMLElement | ShadowRoot) {
tabbableElements.push(el);
}
if (el instanceof HTMLSlotElement && slotChildrenOutsideRootElement(el, root)) {
if (el instanceof HTMLSlotElement && getSlottedChildrenOutsideRootElement(el, root)) {
el.assignedElements({ flatten: true }).forEach((assignedEl: HTMLElement) => {
walk(assignedEl);
});