use-wc 1.0.0-pre.92 → 1.0.0-pre.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/use-wc.mjs +7 -0
- package/package.json +1 -1
package/dist/use-wc.mjs
CHANGED
|
@@ -2128,6 +2128,7 @@ var UseFocusgroup = class extends HTMLElement {
|
|
|
2128
2128
|
this.addEventListener("keydown", (event) => {
|
|
2129
2129
|
let moveTo = -1;
|
|
2130
2130
|
const target = event.target;
|
|
2131
|
+
if (this.#isInsideOpenOverlay(target)) return;
|
|
2131
2132
|
const parent = target.closest("use-focusgroup");
|
|
2132
2133
|
switch (event.key) {
|
|
2133
2134
|
case this.#arrowRightKey:
|
|
@@ -2164,6 +2165,11 @@ var UseFocusgroup = class extends HTMLElement {
|
|
|
2164
2165
|
this.#initializeTabbables(true);
|
|
2165
2166
|
}, true);
|
|
2166
2167
|
}
|
|
2168
|
+
#isInsideOpenOverlay(element) {
|
|
2169
|
+
const root = element.getRootNode();
|
|
2170
|
+
const overlay = (root instanceof ShadowRoot ? root.host : element).closest(":popover-open, dialog[open]");
|
|
2171
|
+
return overlay != null && overlay !== this && this.contains(overlay);
|
|
2172
|
+
}
|
|
2167
2173
|
#observer;
|
|
2168
2174
|
#watchMutations() {
|
|
2169
2175
|
if (this.#observer) return;
|
|
@@ -2206,6 +2212,7 @@ var UseFocusgroup = class extends HTMLElement {
|
|
|
2206
2212
|
const allTabbables = tabbable(this, { getShadowRoot: true });
|
|
2207
2213
|
const filteredTabbables = [];
|
|
2208
2214
|
for (const node of allTabbables) {
|
|
2215
|
+
if (this.#isInsideOpenOverlay(node)) continue;
|
|
2209
2216
|
const parent = node.closest("use-focusgroup");
|
|
2210
2217
|
if (parent && filteredTabbables.includes(parent)) continue;
|
|
2211
2218
|
filteredTabbables.push(parent && this !== parent ? parent : node);
|