I'm using react-select and I'm customizing it,I didn't found an option to do this. Is there some workaround I can use to keep dropdown open when I'm styling it?
-
2https://github.com/JedWatson/react-select/issues/927. There might be some useful comments here. – Yvo Linssen Mar 15 '18 at 12:38
-
12works for me. – user2809286 May 18 '20 at 06:58
11 Answers
In chrome, got to Elements > Event Listeners > open "blur" > with the mouse go to the right of where it is written "document", then you can see a button "Remove" > click on it

- 1,781
- 1
- 10
- 5
-
3
-
18with the latest versions you may need to delete the "focusout" event listener instead of blur. – JonH May 19 '22 at 19:23
If you're using V2 there's a menuIsOpen
prop you can use to keep the menu open at all times.
If you're using Chrome and you have the React Developer Tools plugin, you can inspect your component in the React tab of the console and manually toggle this property right from your browser. For V1, you can toggle the isOpen
state to achieve the same behavior.

- 961
- 1
- 7
- 11
-
I use menuIsOpen. it worked but when I click on select for change my selected option, It didn't open again. – Ali Mar 01 '22 at 10:55
Simple hack goes this way
Run this command on your console open the menu and then wait for 5 seconds and the debugger will automatically be applied and screen will be freezed.
setTimeout(() => {debugger;}, 5000)

- 3,263
- 5
- 30
- 42
-
-
Used to do this; note however that this may prevent e.g. React Dev Tools from working - removing the blur handler per the top answer works better! – btown Jul 13 '22 at 19:26
-
1
Beforehand I exec window.onkeydown = () => {debugger}
in js console and after expanding the dropdown I click any key
It's important to keep developer tools open
-
Doesn't work on Windows 10 Chrome 80+. Dropdown is closed as soon as debugging starts. – Daniel Kmak Jun 22 '20 at 13:47
You can use the menuIsOpen
props. It was on the react-select documentation and it works!
Docs: https://react-select.com/props
Screenshot:

- 91
- 6
Maybe this could help:
<Select
ref={el => (this.selectRef =el)}
onBlur={() => {
setTimeout(
() =>
this.selectRef.setState({
menuIsOpen: true,
}),
50
);
}}
/>

- 7,979
- 7
- 39
- 63

- 84
- 3
-
this is the only thing that worked. by the way, you cannot use this inside set timeout that way, you have to create a variable reference outside – user151496 Jul 20 '21 at 15:52
in select component send this as props
menuIsOpen={true}

- 19,327
- 10
- 37
- 52

- 33
- 2
By using the Chrome React extension, you can force the "isOpen" (v3: "menuIsOpen") state value to true on the Select component.
more info here: https://github.com/JedWatson/react-select/issues/927#issuecomment-313022873

- 1,497
- 1
- 13
- 17
If you are using Google Chrome to debug. You can hover over the select drop down and press Ctrl+Shift+C simultaneously and it should be automatically selected in the debug window

- 4,765
- 8
- 40
- 57

- 96
- 6
Open dropdown and then right click on dropdown... it will drown a pop over and on inspector.. now you can work upon your dropdown.

- 14
- 3
-
1As soon as you click somewhere in the inspector you will lose the focus. – Stan Bright Apr 08 '18 at 03:14
-
This actually won't work, the problem is you cannot perform any action or the menu would disappear – engma Jan 07 '19 at 22:27