Skip to content

Commit ac3396e

Browse files
authored
[EuiSelectable] Fix non-virtualized lists causing Jest errors (#7618)
1 parent 08dbb9b commit ac3396e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

changelogs/upcoming/7618.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**Bug fixes**
2+
3+
- Fixed unvirtualized `EuiSelectable`s to not cause Jest/jsdom errors on active option change

src/components/selectable/selectable_list/selectable_list.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,9 @@ export class EuiSelectableList<T> extends Component<
264264
const activeOptionId = `#${makeOptionId(activeOptionIndex)}`;
265265
const activeOptionEl = this.listBoxRef?.querySelector(activeOptionId);
266266
if (activeOptionEl) {
267-
activeOptionEl.scrollIntoView({ block: 'nearest' });
267+
// TODO: we can remove scrollIntoView's conditional chaining once jsdom stubs it
268+
// @see https://github.com/jsdom/jsdom/issues/1695
269+
activeOptionEl.scrollIntoView?.({ block: 'nearest' });
268270
}
269271
}
270272
}

0 commit comments

Comments
 (0)