carbon-react 123.11.0 → 123.11.2
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/esm/components/menu/menu-full-screen/menu-full-screen.component.js +8 -2
- package/esm/hooks/__internal__/useModalAria/useModalAria.js +6 -0
- package/lib/components/menu/menu-full-screen/menu-full-screen.component.js +8 -2
- package/lib/hooks/__internal__/useModalAria/useModalAria.js +6 -0
- package/package.json +1 -1
|
@@ -45,7 +45,13 @@ export const MenuFullscreen = ({
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
const
|
|
48
|
+
const flattenedChildren = React.Children.toArray(children);
|
|
49
|
+
const childArray = React.Children.toArray(flattenedChildren.map((child, index) => {
|
|
50
|
+
if (index < flattenedChildren.length - 1) {
|
|
51
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, child, /*#__PURE__*/React.createElement(MenuDivider, null));
|
|
52
|
+
}
|
|
53
|
+
return child;
|
|
54
|
+
}));
|
|
49
55
|
return /*#__PURE__*/React.createElement("li", {
|
|
50
56
|
"aria-label": "menu-fullscreen"
|
|
51
57
|
}, /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(FocusTrap, {
|
|
@@ -89,6 +95,6 @@ export const MenuFullscreen = ({
|
|
|
89
95
|
openSubmenuId: null,
|
|
90
96
|
setOpenSubmenuId: /* istanbul ignore next */() => {}
|
|
91
97
|
}
|
|
92
|
-
},
|
|
98
|
+
}, childArray)))))));
|
|
93
99
|
};
|
|
94
100
|
export default MenuFullscreen;
|
|
@@ -14,6 +14,12 @@ export default function useModalAria(containerRef) {
|
|
|
14
14
|
"aria-hidden": rootElement.getAttribute("aria-hidden"),
|
|
15
15
|
inert: rootElement.getAttribute("inert")
|
|
16
16
|
});
|
|
17
|
+
// need to manually call the blur event on any currently-focused element that might be inside the element
|
|
18
|
+
// we're making inert, since Firefox fails to do this, which can result in the focus styles remaining on
|
|
19
|
+
// an input that is no longer focused
|
|
20
|
+
if (rootElement.contains(document.activeElement)) {
|
|
21
|
+
document.activeElement?.blur();
|
|
22
|
+
}
|
|
17
23
|
rootElement.setAttribute("aria-hidden", "true");
|
|
18
24
|
rootElement.setAttribute("inert", "");
|
|
19
25
|
} else if (rootElement !== topModal) {
|
|
@@ -54,7 +54,13 @@ const MenuFullscreen = ({
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
const
|
|
57
|
+
const flattenedChildren = _react.default.Children.toArray(children);
|
|
58
|
+
const childArray = _react.default.Children.toArray(flattenedChildren.map((child, index) => {
|
|
59
|
+
if (index < flattenedChildren.length - 1) {
|
|
60
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, child, /*#__PURE__*/_react.default.createElement(_menuDivider.default, null));
|
|
61
|
+
}
|
|
62
|
+
return child;
|
|
63
|
+
}));
|
|
58
64
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
59
65
|
"aria-label": "menu-fullscreen"
|
|
60
66
|
}, /*#__PURE__*/_react.default.createElement(_portal.default, null, /*#__PURE__*/_react.default.createElement(_focusTrap.default, {
|
|
@@ -98,7 +104,7 @@ const MenuFullscreen = ({
|
|
|
98
104
|
openSubmenuId: null,
|
|
99
105
|
setOpenSubmenuId: /* istanbul ignore next */() => {}
|
|
100
106
|
}
|
|
101
|
-
},
|
|
107
|
+
}, childArray)))))));
|
|
102
108
|
};
|
|
103
109
|
exports.MenuFullscreen = MenuFullscreen;
|
|
104
110
|
var _default = MenuFullscreen;
|
|
@@ -21,6 +21,12 @@ function useModalAria(containerRef) {
|
|
|
21
21
|
"aria-hidden": rootElement.getAttribute("aria-hidden"),
|
|
22
22
|
inert: rootElement.getAttribute("inert")
|
|
23
23
|
});
|
|
24
|
+
// need to manually call the blur event on any currently-focused element that might be inside the element
|
|
25
|
+
// we're making inert, since Firefox fails to do this, which can result in the focus styles remaining on
|
|
26
|
+
// an input that is no longer focused
|
|
27
|
+
if (rootElement.contains(document.activeElement)) {
|
|
28
|
+
document.activeElement?.blur();
|
|
29
|
+
}
|
|
24
30
|
rootElement.setAttribute("aria-hidden", "true");
|
|
25
31
|
rootElement.setAttribute("inert", "");
|
|
26
32
|
} else if (rootElement !== topModal) {
|