@primer/behaviors 0.0.0-20240821180823 → 0.0.0-20241017220534
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,7 +23,7 @@ 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 sentinelChildren = Array.from(mutation.addedNodes
|
|
26
|
+
const sentinelChildren = Array.from(mutation.addedNodes).filter(e => e instanceof HTMLElement && e.classList.contains('sentinel') && e.tagName === 'SPAN');
|
|
27
27
|
if (sentinelChildren.length) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
package/dist/cjs/focus-zone.js
CHANGED
|
@@ -182,7 +182,9 @@ function focusZone(container, settings) {
|
|
|
182
182
|
}
|
|
183
183
|
activeDescendantControl === null || activeDescendantControl === void 0 ? void 0 : activeDescendantControl.removeAttribute('aria-activedescendant');
|
|
184
184
|
container.removeAttribute(hasActiveDescendantAttribute);
|
|
185
|
-
|
|
185
|
+
for (const item of container.querySelectorAll(`[${isActiveDescendantAttribute}]`)) {
|
|
186
|
+
item === null || item === void 0 ? void 0 : item.removeAttribute(isActiveDescendantAttribute);
|
|
187
|
+
}
|
|
186
188
|
activeDescendantCallback === null || activeDescendantCallback === void 0 ? void 0 : activeDescendantCallback(undefined, previouslyActiveElement, false);
|
|
187
189
|
}
|
|
188
190
|
function beginFocusManagement(...elements) {
|
|
@@ -301,7 +303,7 @@ function focusZone(container, settings) {
|
|
|
301
303
|
activeDescendantControl.focus({ preventScroll });
|
|
302
304
|
updateFocusedElement(event.target);
|
|
303
305
|
}
|
|
304
|
-
});
|
|
306
|
+
}, { signal });
|
|
305
307
|
container.addEventListener('mousemove', ({ target }) => {
|
|
306
308
|
if (!(target instanceof Node)) {
|
|
307
309
|
return;
|
|
@@ -318,10 +320,10 @@ function focusZone(container, settings) {
|
|
|
318
320
|
else {
|
|
319
321
|
setActiveDescendant(undefined, currentFocusedElement);
|
|
320
322
|
}
|
|
321
|
-
});
|
|
323
|
+
}, { signal });
|
|
322
324
|
activeDescendantControl.addEventListener('focusout', () => {
|
|
323
325
|
clearActiveDescendant();
|
|
324
|
-
});
|
|
326
|
+
}, { signal });
|
|
325
327
|
}
|
|
326
328
|
else {
|
|
327
329
|
container.addEventListener('focusin', event => {
|
package/dist/esm/focus-trap.mjs
CHANGED
|
@@ -21,7 +21,7 @@ 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 sentinelChildren = Array.from(mutation.addedNodes
|
|
24
|
+
const sentinelChildren = Array.from(mutation.addedNodes).filter(e => e instanceof HTMLElement && e.classList.contains('sentinel') && e.tagName === 'SPAN');
|
|
25
25
|
if (sentinelChildren.length) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
package/dist/esm/focus-zone.mjs
CHANGED
|
@@ -180,7 +180,9 @@ function focusZone(container, settings) {
|
|
|
180
180
|
}
|
|
181
181
|
activeDescendantControl === null || activeDescendantControl === void 0 ? void 0 : activeDescendantControl.removeAttribute('aria-activedescendant');
|
|
182
182
|
container.removeAttribute(hasActiveDescendantAttribute);
|
|
183
|
-
|
|
183
|
+
for (const item of container.querySelectorAll(`[${isActiveDescendantAttribute}]`)) {
|
|
184
|
+
item === null || item === void 0 ? void 0 : item.removeAttribute(isActiveDescendantAttribute);
|
|
185
|
+
}
|
|
184
186
|
activeDescendantCallback === null || activeDescendantCallback === void 0 ? void 0 : activeDescendantCallback(undefined, previouslyActiveElement, false);
|
|
185
187
|
}
|
|
186
188
|
function beginFocusManagement(...elements) {
|
|
@@ -299,7 +301,7 @@ function focusZone(container, settings) {
|
|
|
299
301
|
activeDescendantControl.focus({ preventScroll });
|
|
300
302
|
updateFocusedElement(event.target);
|
|
301
303
|
}
|
|
302
|
-
});
|
|
304
|
+
}, { signal });
|
|
303
305
|
container.addEventListener('mousemove', ({ target }) => {
|
|
304
306
|
if (!(target instanceof Node)) {
|
|
305
307
|
return;
|
|
@@ -316,10 +318,10 @@ function focusZone(container, settings) {
|
|
|
316
318
|
else {
|
|
317
319
|
setActiveDescendant(undefined, currentFocusedElement);
|
|
318
320
|
}
|
|
319
|
-
});
|
|
321
|
+
}, { signal });
|
|
320
322
|
activeDescendantControl.addEventListener('focusout', () => {
|
|
321
323
|
clearActiveDescendant();
|
|
322
|
-
});
|
|
324
|
+
}, { signal });
|
|
323
325
|
}
|
|
324
326
|
else {
|
|
325
327
|
container.addEventListener('focusin', event => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/behaviors",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-20241017220534",
|
|
4
4
|
"description": "Shared behaviors for JavaScript components",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
}
|
|
70
70
|
],
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@arethetypeswrong/cli": "^0.
|
|
72
|
+
"@arethetypeswrong/cli": "^0.16.2",
|
|
73
73
|
"@changesets/changelog-github": "^0.5.0",
|
|
74
74
|
"@changesets/cli": "^2.18.1",
|
|
75
75
|
"@github/prettier-config": "^0.0.6",
|
|
76
|
-
"@rollup/plugin-typescript": "^
|
|
76
|
+
"@rollup/plugin-typescript": "^12.1.0",
|
|
77
77
|
"@rollup/wasm-node": "^4.19.1",
|
|
78
78
|
"@size-limit/preset-small-lib": "^11.1.4",
|
|
79
79
|
"@testing-library/react": "^16.0.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@types/jest": "^29.5.11",
|
|
82
82
|
"@types/node": "^22.0.0",
|
|
83
83
|
"@types/react": "^18.2.23",
|
|
84
|
-
"esbuild": "^0.
|
|
84
|
+
"esbuild": "^0.24.0",
|
|
85
85
|
"esbuild-jest": "^0.5.0",
|
|
86
86
|
"eslint": "^8.50.0",
|
|
87
87
|
"eslint-plugin-github": "^5.0.0",
|