From de1fbb8bb95fee6b5539b371861284d74ed515b5 Mon Sep 17 00:00:00 2001 From: Fazekas Viktor Date: Wed, 4 Oct 2017 12:40:11 +0200 Subject: [PATCH 1/2] [fixed] maybeScrollItemIntoView exception when itemNode is not found --- lib/Autocomplete.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Autocomplete.js b/lib/Autocomplete.js index 202389d8..024c6a92 100644 --- a/lib/Autocomplete.js +++ b/lib/Autocomplete.js @@ -246,8 +246,10 @@ class Autocomplete extends React.Component { if (this.isOpen() && this.state.highlightedIndex !== null) { const itemNode = this.refs[`item-${this.state.highlightedIndex}`] const menuNode = this.refs.menu + const foundItemNode = findDOMNode(itemNode); + if (!foundItemNode) return; scrollIntoView( - findDOMNode(itemNode), + foundItemNode, findDOMNode(menuNode), { onlyScrollIfNeeded: true } ) From 0b95da93338c94fa7303f7dd20e332bc5f08c0ef Mon Sep 17 00:00:00 2001 From: Fazekas Viktor Date: Wed, 4 Oct 2017 14:26:43 +0200 Subject: [PATCH 2/2] remove semicolon --- lib/Autocomplete.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Autocomplete.js b/lib/Autocomplete.js index 024c6a92..15b60ae3 100644 --- a/lib/Autocomplete.js +++ b/lib/Autocomplete.js @@ -246,8 +246,8 @@ class Autocomplete extends React.Component { if (this.isOpen() && this.state.highlightedIndex !== null) { const itemNode = this.refs[`item-${this.state.highlightedIndex}`] const menuNode = this.refs.menu - const foundItemNode = findDOMNode(itemNode); - if (!foundItemNode) return; + const foundItemNode = findDOMNode(itemNode) + if (!foundItemNode) return scrollIntoView( foundItemNode, findDOMNode(menuNode),