carbon-react 142.11.2 → 142.11.4
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.
|
@@ -38,6 +38,7 @@ const Toast = /*#__PURE__*/React.forwardRef(({
|
|
|
38
38
|
const closeIconRef = useRef(null);
|
|
39
39
|
const focusedElementBeforeOpening = useRef(null);
|
|
40
40
|
const [tabIndex, setTabIndex] = useState(0);
|
|
41
|
+
const ariaLabelledBy = `${!isNotice && toastIconId.current} ${toastContentId.current}`;
|
|
41
42
|
let refToPass = toastRef;
|
|
42
43
|
if (ref && typeof ref === "object" && "current" in ref) {
|
|
43
44
|
refToPass = ref;
|
|
@@ -160,7 +161,8 @@ const Toast = /*#__PURE__*/React.forwardRef(({
|
|
|
160
161
|
isNotice: isNotice,
|
|
161
162
|
"data-role": "toast-wrapper",
|
|
162
163
|
role: "region",
|
|
163
|
-
"aria-
|
|
164
|
+
"aria-hidden": !open,
|
|
165
|
+
"aria-labelledby": open ? ariaLabelledBy : undefined
|
|
164
166
|
}, /*#__PURE__*/React.createElement(TransitionGroup, null, renderToastContent())));
|
|
165
167
|
});
|
|
166
168
|
if (process.env.NODE_ENV !== "production") {
|
|
@@ -47,6 +47,7 @@ const Toast = exports.Toast = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
47
47
|
const closeIconRef = (0, _react.useRef)(null);
|
|
48
48
|
const focusedElementBeforeOpening = (0, _react.useRef)(null);
|
|
49
49
|
const [tabIndex, setTabIndex] = (0, _react.useState)(0);
|
|
50
|
+
const ariaLabelledBy = `${!isNotice && toastIconId.current} ${toastContentId.current}`;
|
|
50
51
|
let refToPass = toastRef;
|
|
51
52
|
if (ref && typeof ref === "object" && "current" in ref) {
|
|
52
53
|
refToPass = ref;
|
|
@@ -169,7 +170,8 @@ const Toast = exports.Toast = /*#__PURE__*/_react.default.forwardRef(({
|
|
|
169
170
|
isNotice: isNotice,
|
|
170
171
|
"data-role": "toast-wrapper",
|
|
171
172
|
role: "region",
|
|
172
|
-
"aria-
|
|
173
|
+
"aria-hidden": !open,
|
|
174
|
+
"aria-labelledby": open ? ariaLabelledBy : undefined
|
|
173
175
|
}, /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.TransitionGroup, null, renderToastContent())));
|
|
174
176
|
});
|
|
175
177
|
if (process.env.NODE_ENV !== "production") {
|