carbon-react 124.6.0 → 124.6.1

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.
@@ -324,8 +324,15 @@ const SelectList = /*#__PURE__*/React.forwardRef(({
324
324
  return;
325
325
  }
326
326
  setCurrentOptionsListIndex(indexOfMatch);
327
- virtualizer.scrollToIndex(indexOfMatch, SCROLL_OPTIONS);
328
- }, [getIndexOfMatch, highlightedValue, virtualizer, handleListScroll, listContainerRef]);
327
+ }, [getIndexOfMatch, highlightedValue]);
328
+
329
+ // ensure that the currently-selected option is always visible immediately after
330
+ // it has been changed
331
+ useEffect(() => {
332
+ if (currentOptionsListIndex > -1) {
333
+ virtualizer.scrollToIndex(currentOptionsListIndex, SCROLL_OPTIONS);
334
+ }
335
+ }, [currentOptionsListIndex, virtualizer]);
329
336
  useEffect(() => {
330
337
  if (isLoading && currentOptionsListIndex === lastOptionIndex && lastOptionIndex > -1) {
331
338
  virtualizer.scrollToIndex(lastOptionIndex, {
@@ -333,8 +333,15 @@ const SelectList = /*#__PURE__*/_react.default.forwardRef(({
333
333
  return;
334
334
  }
335
335
  setCurrentOptionsListIndex(indexOfMatch);
336
- virtualizer.scrollToIndex(indexOfMatch, SCROLL_OPTIONS);
337
- }, [getIndexOfMatch, highlightedValue, virtualizer, handleListScroll, listContainerRef]);
336
+ }, [getIndexOfMatch, highlightedValue]);
337
+
338
+ // ensure that the currently-selected option is always visible immediately after
339
+ // it has been changed
340
+ (0, _react.useEffect)(() => {
341
+ if (currentOptionsListIndex > -1) {
342
+ virtualizer.scrollToIndex(currentOptionsListIndex, SCROLL_OPTIONS);
343
+ }
344
+ }, [currentOptionsListIndex, virtualizer]);
338
345
  (0, _react.useEffect)(() => {
339
346
  if (isLoading && currentOptionsListIndex === lastOptionIndex && lastOptionIndex > -1) {
340
347
  virtualizer.scrollToIndex(lastOptionIndex, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "124.6.0",
3
+ "version": "124.6.1",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "files": [
6
6
  "lib",