Skip to content

Fixed focus in SLDSLookup #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 4, 2015
Merged

Fixed focus in SLDSLookup #49

merged 3 commits into from
Nov 4, 2015

Conversation

minevskiy
Copy link
Contributor

@madpotato , this is the cause of menu not closing on selection:

  1. isOpen wasn't set to false because the blur event was not fired
  2. blur was not fired because there was no focus set in the first place
  3. focus was not set because of a bug in componentDidUpdate which is fixed in this PR

@@ -47,10 +47,10 @@ class SLDSLookup extends React.Component {

componentDidUpdate(prevProps, prevState){
let lookup = this.props.type + 'Lookup';
if(prevState.selectedIndex && !this.state.selectIndex){
if(!isNaN(parseInt(prevState.selectedIndex)) && isNaN(parseInt(this.state.selectedIndex))){
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that there was a typo: selectIndex rather than selectedIndex

ivanbogdanov pushed a commit that referenced this pull request Nov 4, 2015
@ivanbogdanov ivanbogdanov merged commit 12a8305 into master Nov 4, 2015
@minevskiy minevskiy deleted the im-fix-lookup-focus branch November 4, 2015 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants