question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Can't test autofocus prop

See original GitHub issue

Hey, 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:closed
  • Created 4 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
amit-davidsoncommented, Mar 8, 2021

@ebonow I’ll test this and re-open if needed. Thanks!

0reactions
ebonowcommented, Mar 8, 2021

@amit-davidson

I decided to revisit this and it appears that the sandbox that is referenced in the testing suite is using autofocus instead of autoFocus 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. codesandbox

I 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found