@carbon/ibm-products 2.43.2-canary.292 → 2.43.2-canary.295

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.
@@ -159,15 +159,21 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
159
159
  useEffect(function () {
160
160
  if (open) {
161
161
  // Focusing the first element or selectorPrimaryFocus element
162
- setTimeout(function () {
163
- if (selectorPrimaryFocus) {
164
- return specifiedElement === null || specifiedElement === void 0 ? void 0 : specifiedElement.focus();
162
+ if (selectorPrimaryFocus && getSpecificElement(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current, selectorPrimaryFocus)) {
163
+ var _window2;
164
+ var specifiedEl = getSpecificElement(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current, selectorPrimaryFocus);
165
+ if (specifiedEl && ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(specifiedEl)) === null || _window2 === void 0 ? void 0 : _window2.display) !== 'none') {
166
+ setTimeout(function () {
167
+ return specifiedEl.focus();
168
+ }, 0);
169
+ return;
165
170
  }
166
- firstElement === null || firstElement === void 0 || firstElement.focus();
171
+ }
172
+ setTimeout(function () {
173
+ return firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
167
174
  }, 0);
168
175
  }
169
- // eslint-disable-next-line react-hooks/exhaustive-deps
170
- }, [open]);
176
+ }, [firstElement, modalRef, open, selectorPrimaryFocus]);
171
177
  useEffect(function () {
172
178
  if (prevOpen && !open && launcherButtonRef) {
173
179
  setTimeout(function () {
@@ -161,15 +161,21 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
161
161
  React.useEffect(function () {
162
162
  if (open) {
163
163
  // Focusing the first element or selectorPrimaryFocus element
164
- setTimeout(function () {
165
- if (selectorPrimaryFocus) {
166
- return specifiedElement === null || specifiedElement === void 0 ? void 0 : specifiedElement.focus();
164
+ if (selectorPrimaryFocus && useFocus.getSpecificElement(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current, selectorPrimaryFocus)) {
165
+ var _window2;
166
+ var specifiedEl = useFocus.getSpecificElement(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current, selectorPrimaryFocus);
167
+ if (specifiedEl && ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(specifiedEl)) === null || _window2 === void 0 ? void 0 : _window2.display) !== 'none') {
168
+ setTimeout(function () {
169
+ return specifiedEl.focus();
170
+ }, 0);
171
+ return;
167
172
  }
168
- firstElement === null || firstElement === void 0 || firstElement.focus();
173
+ }
174
+ setTimeout(function () {
175
+ return firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
169
176
  }, 0);
170
177
  }
171
- // eslint-disable-next-line react-hooks/exhaustive-deps
172
- }, [open]);
178
+ }, [firstElement, modalRef, open, selectorPrimaryFocus]);
173
179
  React.useEffect(function () {
174
180
  if (prevOpen && !open && launcherButtonRef) {
175
181
  setTimeout(function () {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.43.2-canary.292+e7e025e03",
4
+ "version": "2.43.2-canary.295+dc53a099b",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -120,5 +120,5 @@
120
120
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
121
121
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
122
122
  },
123
- "gitHead": "e7e025e034fdcbc18f645145031f56ed07e6cced"
123
+ "gitHead": "dc53a099baba3450d769b9e4581c524673529fa0"
124
124
  }