Merge pull request #4470 from rkfg/autocomplete-fix

Assert type of domNode as HTMLElement to fix build
pull/21833/head
Michael Telatynski 2020-04-22 21:20:24 +01:00 committed by GitHub
commit 22d6c59213
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -259,7 +259,7 @@ export default class Autocomplete extends React.PureComponent<IProps, IState> {
const selectedCompletion = this.refs[`completion${this.state.selectionOffset}`];
if (selectedCompletion && this.containerRef.current) {
const domNode = ReactDOM.findDOMNode(selectedCompletion);
const offsetTop = domNode && domNode.offsetTop;
const offsetTop = domNode && (domNode as HTMLElement).offsetTop;
if (offsetTop > this.containerRef.current.scrollTop + this.containerRef.current.offsetHeight ||
offsetTop < this.containerRef.current.scrollTop) {
this.containerRef.current.scrollTop = offsetTop - this.containerRef.current.offsetTop;