@primer/behaviors 0.0.0-20251214175049 → 0.0.0-20251215025613
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/cjs/focus-trap.js
CHANGED
|
@@ -23,9 +23,10 @@ function observeFocusTrap(container, sentinels) {
|
|
|
23
23
|
const observer = new MutationObserver(mutations => {
|
|
24
24
|
for (const mutation of mutations) {
|
|
25
25
|
if (mutation.type === 'childList' && mutation.addedNodes.length) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
for (const node of mutation.addedNodes) {
|
|
27
|
+
if (node instanceof HTMLElement && node.tagName === 'SPAN' && node.classList.contains('sentinel')) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
29
30
|
}
|
|
30
31
|
const firstChild = container.firstElementChild;
|
|
31
32
|
const lastChild = container.lastElementChild;
|
package/dist/cjs/focus-zone.js
CHANGED
|
@@ -348,6 +348,11 @@ function focusZone(container, settings) {
|
|
|
348
348
|
if (!(target instanceof Node)) {
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
351
|
+
const targetIndex = target instanceof HTMLElement ? focusableElements.indexOf(target) : -1;
|
|
352
|
+
if (targetIndex >= 0) {
|
|
353
|
+
updateFocusedElement(focusableElements[targetIndex]);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
351
356
|
const focusableElement = focusableElements.find(element => element.contains(target));
|
|
352
357
|
if (focusableElement) {
|
|
353
358
|
updateFocusedElement(focusableElement);
|
package/dist/esm/focus-trap.mjs
CHANGED
|
@@ -21,9 +21,10 @@ function observeFocusTrap(container, sentinels) {
|
|
|
21
21
|
const observer = new MutationObserver(mutations => {
|
|
22
22
|
for (const mutation of mutations) {
|
|
23
23
|
if (mutation.type === 'childList' && mutation.addedNodes.length) {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
for (const node of mutation.addedNodes) {
|
|
25
|
+
if (node instanceof HTMLElement && node.tagName === 'SPAN' && node.classList.contains('sentinel')) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
27
28
|
}
|
|
28
29
|
const firstChild = container.firstElementChild;
|
|
29
30
|
const lastChild = container.lastElementChild;
|
package/dist/esm/focus-zone.mjs
CHANGED
|
@@ -346,6 +346,11 @@ function focusZone(container, settings) {
|
|
|
346
346
|
if (!(target instanceof Node)) {
|
|
347
347
|
return;
|
|
348
348
|
}
|
|
349
|
+
const targetIndex = target instanceof HTMLElement ? focusableElements.indexOf(target) : -1;
|
|
350
|
+
if (targetIndex >= 0) {
|
|
351
|
+
updateFocusedElement(focusableElements[targetIndex]);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
349
354
|
const focusableElement = focusableElements.find(element => element.contains(target));
|
|
350
355
|
if (focusableElement) {
|
|
351
356
|
updateFocusedElement(focusableElement);
|