Skip to content
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

SearchBox: Fixed bug when autoFocus set to true #6566

Merged
merged 3 commits into from
Oct 4, 2018

Conversation

gregdardis
Copy link
Contributor

@gregdardis gregdardis commented Oct 4, 2018

Pull request checklist

Description of changes

If autoFocus={true} for the SearchBox component, onFocusCapture for the root div (here) is called before the ref is set to this._rootElement on the same line.

This results in this._rootElement.current being null in this._onFocusCapture. This seems to be an issue with React, shown here, and I got the workaround from the very same issue.

Microsoft Reviewers: Open in CodeFlow

Partially verified

This commit is signed with the committer’s verified signature.
gsmet’s contribution has been verified via GPG key.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
@KevinTCoughlin KevinTCoughlin self-requested a review October 4, 2018 17:50
@gregdardis gregdardis changed the title Fix auto focus bug Fix SearchBox autoFocus bug Oct 4, 2018
@micahgodbolt
Copy link
Member

Double checked it on my local, focus is now working in FF and Chrome, and not throwing any errors.

@micahgodbolt micahgodbolt merged commit 678fbae into microsoft:master Oct 4, 2018
@msft-github-bot
Copy link
Contributor

🎉[email protected] has been released which incorporates this pull request.:tada:

Handy Links:

@micahgodbolt micahgodbolt changed the title Fix SearchBox autoFocus bug SearchBox: Fixed bug when autoFocus set to true Oct 10, 2018
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SearchBox autoFocus causes an Uncaught TypeError in office-ui-fabric-react (6.76.0)
3 participants