Skip to content

Commit

Permalink
[EuiSelectable] Fix non-virtualized lists causing Jest errors (#7618)
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen authored Mar 25, 2024
1 parent 08dbb9b commit ac3396e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelogs/upcoming/7618.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Bug fixes**

- Fixed unvirtualized `EuiSelectable`s to not cause Jest/jsdom errors on active option change
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ export class EuiSelectableList<T> extends Component<
const activeOptionId = `#${makeOptionId(activeOptionIndex)}`;
const activeOptionEl = this.listBoxRef?.querySelector(activeOptionId);
if (activeOptionEl) {
activeOptionEl.scrollIntoView({ block: 'nearest' });
// TODO: we can remove scrollIntoView's conditional chaining once jsdom stubs it
// @see https://github.com/jsdom/jsdom/issues/1695
activeOptionEl.scrollIntoView?.({ block: 'nearest' });
}
}
}
Expand Down

0 comments on commit ac3396e

Please sign in to comment.