react-select icon indicating copy to clipboard operation
react-select copied to clipboard

Cannot open dropdown after value was selected

Open enheit opened this issue 9 years ago • 9 comments

I have found an issue which is not allow you to re-open dropdown after value selecting.

Create component <Select options={ ... } value={ ... } />. Add additional property to prevent dropdown resizing autosize={ false }. Click on the dropdown body -> select value -> try to click on the body again... Component is not opening anymore, cuz input took some size of component and this occupied area is not clickable anymore. You can re-open input by clicking on the arrow button, click out of component and click on the body again, click at some side of component (not at the middle).

Images (GIFs) are shown in related post: https://github.com/JedWatson/react-select/issues/1886 Codesandbox: https://codesandbox.io/s/qx4v3k2py

P.S. Temporary workaround is to add autoBlur to the component which do the same click outside.

enheit avatar Jul 24 '17 13:07 enheit

HI @enheit thank you for reporting the issue with a reproducible case. Will take a look.

agirton avatar Jul 24 '17 16:07 agirton

+1

dariuszpaluch avatar Aug 30 '17 09:08 dariuszpaluch

I think this is a duplicate in respect to: https://github.com/JedWatson/react-select/issues/1316

See also the discussion here: https://github.com/JedWatson/react-select/pull/1746

cbergmiller avatar Sep 01 '17 12:09 cbergmiller

So the fix in #1746 won't be merged for this I presume? For now the only workaround is to set autoBlur to true? This breaks accessibility as I have to re-focus in the field now to change the value.

glambert avatar Sep 13 '17 18:09 glambert

Found a workaround for this in the mean time, in the CSS:

.has-value.is-pseudo-focused .Select-input {
  // Always show the input even on pseudo-focused. This fixes an issue
  // when `autosize` is set to `false`, an option is chosen, and we
  // try to re-open the menu by clicking on the current option.
  // The `opacity: 0;` below makes it that we can't click to open the
  // menu unless we focus out, or click on the "clear" or "arrow".
  // More on this here: https://github.com/JedWatson/react-select/issues/1887
  // opacity: 0;
}

Not the best as it always shows the blinking cursor even if its in pseudo-focused state, but we thought its much better than not being able to re-open the menu by clicking. Also, even in pseudo-focused mode you can type, so having the text cursor clearly shows the user he can still type to change the value.

I'll keep an eye on this issue and if I have time try to find a fix and submit a PR.

glambert avatar Sep 14 '17 14:09 glambert

Another finding, again for https://github.com/JedWatson/react-select/blob/49b12b06b98b046cff923b9a5dd4689506ef07ac/less/control.less#L98

If I put visibility: hidden; instead of opacity: 0; then I can re-open the menu on click successfully. @agirton would you see any possible issues down the road if it was changed like this?

glambert avatar Sep 14 '17 14:09 glambert

Nevermind https://github.com/JedWatson/react-select/issues/1887#issuecomment-329501853, this makes the Select blur since its not visible, I'd rather keep the focus and have the text cursor 😉

glambert avatar Sep 14 '17 14:09 glambert

I've been able to reproduce this and resolved it, see the referenced commit for more information

JedWatson avatar Nov 24 '17 05:11 JedWatson

I use version "react-select": "^2.3.0" is still cannot open dropdown after value was selected.

tudiantuan avatar Oct 23 '19 12:10 tudiantuan