[Bug] Can't test autofocus prop
See original GitHub issueHey,
I’m using the autoFocus prop in the dropdown and it works in the browser, but I’m having trouble testing it. I’m using the autoFocus prop and it doesn’t seem to open the menu when I search for the options (No results for searching react-select-dropdown-multiple__option
by className)
I investigated more into the code and found this:https://github.com/JedWatson/react-select/blob/d78730377e25658a5df2930faee54574e757d463/packages/react-select/src/__tests__/Select.test.js#L1756.
Seems that this test is intentionally not tested. I wanted to know if it’s planned to be solved anytime soon and if there’s a workaround for testing this prop?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Keyboard doesn't show up when autoFocus on component ...
I solved the problem by showing TextInput only in focused screen. In other words, re-showing TextInput fires auto focus again. const ...
Read more >Can't focus elements on load in Chrome - very weird bug (in ...
The problem only started to appear recently, but I do not believe it's an issue with the app itself, as I tried rolling...
Read more >Camera Auto Focus problem / bug GALAXY S6 - XDA Forums
Hi Guys, Just got my phone replaced because the screen was sometimes unresponsive when layed flat on a surface. Now I got a...
Read more >Error when using autofocus on an input element (Reactjs)
Coding example for the question Error when using autofocus on an input element (Reactjs)-Reactjs.
Read more >3 ways to autofocus an input in React that ALMOST always work!
Deep dive into the autofocus attribute, the focus() method, the autoFocus prop, the useRef hook and callback refs.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ebonow I’ll test this and re-open if needed. Thanks!
@amit-davidson
I decided to revisit this and it appears that the sandbox that is referenced in the testing suite is using
autofocus
instead ofautoFocus
as it is documented. After updating the version and using the correct prop name, I was able to get a codesandbox that works for both isMulti and singleSelect. codesandboxI revisited the testing harness and was able to run the unit tests as expected and without issue. Additionally, I was able to confirm another that had been commented out.
I have created a PR that will update the test suite to avoid confusion, but seems that I can safely close this issue. Please, let me know if you are still experiencing issues, and we can re-open this.