We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 97b370b commit c14a6dfCopy full SHA for c14a6df
components/lib/listbox/ListBox.js
@@ -474,6 +474,10 @@ export const ListBox = React.memo(
474
475
const scrollInView = (index = -1) => {
476
setTimeout(() => {
477
+ // As long as this is a timeout - there is not guarantee that listRef will still
478
+ // exist by the moment of calling that function. So, if list is already destroyed
479
+ // by this moment - do nothing:
480
+ if (!listRef.current) return;
481
const idx = index !== -1 ? `${id.current}_${index}` : focusedOptionId();
482
const element = listRef.current.querySelector(`li[id="${idx}"]`);
483
0 commit comments