carbon-react 124.2.1 → 124.2.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.
@@ -78,6 +78,7 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
78
78
  label
79
79
  });
80
80
  const focusTimer = useRef(null);
81
+ const openOnFocusFlagBlock = useRef(false);
81
82
  if (!deprecateInputRefWarnTriggered && inputRef) {
82
83
  deprecateInputRefWarnTriggered = true;
83
84
  Logger.deprecate("The `inputRef` prop in `Filterable Select` component is deprecated and will soon be removed. Please use `ref` instead.");
@@ -280,11 +281,13 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
280
281
  triggerChange(newValue, selectionConfirmed);
281
282
  setActiveDescendantId(selectedOptionId);
282
283
  if (selectionType !== "navigationKey") {
284
+ openOnFocusFlagBlock.current = !!openOnFocus;
283
285
  setOpen(false);
284
286
  textboxRef?.focus();
285
287
  textboxRef?.select();
288
+ openOnFocusFlagBlock.current = false;
286
289
  }
287
- }, [textboxRef, triggerChange]);
290
+ }, [textboxRef, triggerChange, openOnFocus]);
288
291
  const onSelectListClose = useCallback(() => {
289
292
  setOpen(false);
290
293
  setMatchingText(selectedValue, true);
@@ -310,6 +313,9 @@ const FilterableSelect = /*#__PURE__*/React.forwardRef(({
310
313
  if (focusTimer.current) {
311
314
  clearTimeout(focusTimer.current);
312
315
  }
316
+ if (openOnFocusFlagBlock.current) {
317
+ return;
318
+ }
313
319
 
314
320
  // we need to use a timeout here as there is a race condition when rendered in a modal
315
321
  // whereby the select list isn't visible when the select is auto focused straight away
@@ -87,6 +87,7 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
87
87
  label
88
88
  });
89
89
  const focusTimer = (0, _react.useRef)(null);
90
+ const openOnFocusFlagBlock = (0, _react.useRef)(false);
90
91
  if (!deprecateInputRefWarnTriggered && inputRef) {
91
92
  deprecateInputRefWarnTriggered = true;
92
93
  _logger.default.deprecate("The `inputRef` prop in `Filterable Select` component is deprecated and will soon be removed. Please use `ref` instead.");
@@ -289,11 +290,13 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
289
290
  triggerChange(newValue, selectionConfirmed);
290
291
  setActiveDescendantId(selectedOptionId);
291
292
  if (selectionType !== "navigationKey") {
293
+ openOnFocusFlagBlock.current = !!openOnFocus;
292
294
  setOpen(false);
293
295
  textboxRef?.focus();
294
296
  textboxRef?.select();
297
+ openOnFocusFlagBlock.current = false;
295
298
  }
296
- }, [textboxRef, triggerChange]);
299
+ }, [textboxRef, triggerChange, openOnFocus]);
297
300
  const onSelectListClose = (0, _react.useCallback)(() => {
298
301
  setOpen(false);
299
302
  setMatchingText(selectedValue, true);
@@ -319,6 +322,9 @@ const FilterableSelect = exports.FilterableSelect = /*#__PURE__*/_react.default.
319
322
  if (focusTimer.current) {
320
323
  clearTimeout(focusTimer.current);
321
324
  }
325
+ if (openOnFocusFlagBlock.current) {
326
+ return;
327
+ }
322
328
 
323
329
  // we need to use a timeout here as there is a race condition when rendered in a modal
324
330
  // whereby the select list isn't visible when the select is auto focused straight away
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "124.2.1",
3
+ "version": "124.2.2",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",