Skip to content

Commit 12a8305

Browse files
committed
Merge pull request #49 from salesforce-ux/im-fix-lookup-focus
Fixed focus in SLDSLookup
2 parents d7d85fd + 5493b18 commit 12a8305

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

components/SLDSLookup/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ class SLDSLookup extends React.Component {
4747

4848
componentDidUpdate(prevProps, prevState){
4949
let lookup = this.props.type + 'Lookup';
50-
if(prevState.selectedIndex && !this.state.selectIndex){
50+
if(!isNaN(parseInt(prevState.selectedIndex)) && isNaN(parseInt(this.state.selectedIndex))){
5151
if(this.refs[lookup]) React.findDOMNode(this.refs[lookup]).focus();
5252
}
53-
else if(!prevState.selectedIndex && this.state.selectedIndex){
53+
else if(isNaN(parseInt(prevState.selectedIndex)) && !isNaN(parseInt(this.state.selectedIndex))){
5454
let selectedItem = 'pill-' + this.state.selectedIndex;
5555
if(this.refs[selectedItem]) React.findDOMNode(this.refs[selectedItem]).focus();
5656
}

0 commit comments

Comments
 (0)