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

Fix _this.input.focus() is undefined issue on mobile #782

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix _this.input.focus() is undefined issue on mobile #782

wants to merge 1 commit into from

Conversation

ZicklePop
Copy link

@ZicklePop ZicklePop commented Dec 21, 2020

On mobile browsers I've seen this problem in our error logs quite often:

TypeError: l.input.focus is not a function
1
File "webpack:///./node_modules/react-autosuggest/dist/Autosuggest.js" line 249 col 19 in Autosuggest
_this.input.focus();

It's very similar to what has been mentioned in these issues:
#646
#669

I simply wrapped the focus function so that we make sure it is defined before trying to call the function.

We were able to reproduce the bug consistently by scrolling on the dropdown component in a mobile browser or iOS Simulator.

Hope this helps!

@Stephane-Ag
Copy link

I've been trying to replicate this for so long. Thank you.
Didn't even know where this issue was coming from. But indeed needed to scroll from the Autosuggest dropdown. It sends that error even though there's nothing to scroll..

@carolineBda
Copy link

Hello, can we merge this PR ? I also get the same error

@ZicklePop
Copy link
Author

@carolineBda at this point I'd suggest migrating to another package that is maintained. The other option is to use patch-package method but that will increase tech debt in your project even more.

@carolineBda
Copy link

@ZicklePop ok thanks for your answer

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.

None yet

4 participants