@deque/cauldron-react 7.6.0-canary.a7eb9452 → 7.6.0-canary.c6d1784a
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/lib/index.js +10 -8
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -517,7 +517,7 @@ var Accordion = function (_a) {
|
|
|
517
517
|
var panelProps = panelElement.props;
|
|
518
518
|
return (React__default["default"].createElement("div", tslib.__assign({ className: "Accordion" }, props),
|
|
519
519
|
React__default["default"].createElement(ExpandCollapsePanel, tslib.__assign({ id: panelProps.id || "".concat(elementId, "-panel"), open: open, onToggle: onToggle, animationTiming: animationTiming }, panelProps),
|
|
520
|
-
React__default["default"].createElement(PanelTrigger$1, tslib.__assign({ iconCollapsed: "triangle-right", iconExpanded: "triangle-down",
|
|
520
|
+
React__default["default"].createElement(PanelTrigger$1, tslib.__assign({ iconCollapsed: "triangle-right", iconExpanded: "triangle-down", "aria-controls": panelProps.id || "".concat(elementId, "-panel"), heading: trigger.props.heading }, trigger.props, { className: classNames__default["default"]('Accordion__trigger', trigger.props.className) }), trigger),
|
|
521
521
|
panelElement)));
|
|
522
522
|
};
|
|
523
523
|
Accordion.displayName = 'Accordion';
|
|
@@ -1420,7 +1420,7 @@ function createFocusTrap(targetElement, initialFocusElement) {
|
|
|
1420
1420
|
suspended: false
|
|
1421
1421
|
};
|
|
1422
1422
|
var focusListener = function (event) {
|
|
1423
|
-
var _a, _b
|
|
1423
|
+
var _a, _b;
|
|
1424
1424
|
var eventTarget = event.target;
|
|
1425
1425
|
var elementContainsTarget = elementContains(targetElement, eventTarget);
|
|
1426
1426
|
if (focusTrapMetadata.suspended) {
|
|
@@ -1438,24 +1438,26 @@ function createFocusTrap(targetElement, initialFocusElement) {
|
|
|
1438
1438
|
return;
|
|
1439
1439
|
}
|
|
1440
1440
|
var focusableElements = Array.from((targetElement === null || targetElement === void 0 ? void 0 : targetElement.querySelectorAll(focusable__default["default"])) || []);
|
|
1441
|
+
// Tab stops such as contenteditable and video[controls] can report tabIndex -1 without a tabindex attribute.
|
|
1442
|
+
var wrapTargets = focusableElements.filter(function (element) { return !(element.hasAttribute('tabindex') && element.tabIndex < 0); });
|
|
1441
1443
|
// If focus reaches the trap guards, we need to wrap focus around to the leading
|
|
1442
1444
|
// or trailing focusable element depending on which guard obtained focus
|
|
1443
|
-
if (
|
|
1444
|
-
|
|
1445
|
+
if (wrapTargets.length && eventTarget === startGuard) {
|
|
1446
|
+
wrapTargets[wrapTargets.length - 1].focus();
|
|
1445
1447
|
return;
|
|
1446
1448
|
}
|
|
1447
|
-
else if (
|
|
1448
|
-
|
|
1449
|
+
else if (wrapTargets.length && eventTarget === endGuard) {
|
|
1450
|
+
wrapTargets[0].focus();
|
|
1449
1451
|
return;
|
|
1450
1452
|
}
|
|
1451
1453
|
// If focus somehow escaped the trap, we need to try to restore focus to
|
|
1452
1454
|
// to a suitable focusable element within the focus trap target. Otherwise
|
|
1453
1455
|
// we'll need to focus on an alternative within the container.
|
|
1454
1456
|
if (elementContains(targetElement, focusTrapMetadata.lastFocusedElement)) {
|
|
1455
|
-
(
|
|
1457
|
+
(_a = focusTrapMetadata.lastFocusedElement) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1456
1458
|
}
|
|
1457
1459
|
else if (focusableElements.length) {
|
|
1458
|
-
(
|
|
1460
|
+
(_b = focusableElements[0]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
1459
1461
|
}
|
|
1460
1462
|
else {
|
|
1461
1463
|
// if there are no focusable elements, just focus the container
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deque/cauldron-react",
|
|
3
|
-
"version": "7.6.0-canary.
|
|
3
|
+
"version": "7.6.0-canary.c6d1784a",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Fully accessible react components library for Deque Cauldron",
|
|
6
6
|
"homepage": "https://cauldron.dequelabs.com/",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@rollup/plugin-typescript": "^11.1.2",
|
|
38
38
|
"@svgr/rollup": "^6.1.2",
|
|
39
39
|
"@testing-library/dom": "^10.4.0",
|
|
40
|
-
"@testing-library/jest-dom": "^7.0.
|
|
40
|
+
"@testing-library/jest-dom": "^7.0.1",
|
|
41
41
|
"@testing-library/react": "^16.0.1",
|
|
42
42
|
"@testing-library/user-event": "^14.6.7",
|
|
43
43
|
"@types/classnames": "^2.2.10",
|