Open jphawk opened 2 years ago
@jphawk If I understand this correctly the main problem you encounter is that the "Loading..." text inside the menu is visible on click, but not on keyboard focus immediately after first render?
First, click and keyboard focus have different behaviors, because <select>
element opens on click and not on keyboard focus. But this behavior is controllable using the openMenuOnClick
and openMenuOnFocus
props.
Second, the "Loading..." text is visible because the Select
is still loading your defaultOptions
after first render due to the 500ms debounce and the 1s loading timeout of your options.
@Rall3n
If I understand this correctly the main problem you encounter is that the "Loading..." text inside the menu is visible on click, but not on keyboard focus immediately after first render?
Correct, "Loading..." is visible on first click, but not on first keyboard focus. I would like to prevent "Loading..." appearing on first click. I understand why it is happening and that the select is still loading options, but users don't need to see this process on the first interaction when they haven't even typed anything yet. To me it looks like a UI bug, which clearly doesn't happen on focus and on click as well when it's not the first one.
I'm aware of openMenuOnClick
and openMenuOnFocus
, but these props do not solve my problem of preventing "Loading..." to appear on first click with debounce. I'm quite happy with default functionality, but in this case defaults for focus and click behaviour should match from the UI point of view, but they don't.
Hello,
I noticed that AsyncSelect behaviour is weird when I use a lodash
debounce
function together withdefaultOptions={true}
. When I use keyboard to focus the Select component, I can start typing and both loading state in the menu and options appear as intended. However, when I click the Select component, I can see a Loading state in the Menu for a moment which I think isn't supposed to be visible and then it disappears. Looks like there is some difference in handling this between onClick and onFocus events.Here is a Sandbox where you can check this bug.
How to reproduce?
Can be compared to the keyboard behaviour:
Tab
to AsyncSelectAre you reporting a bug or runtime error?
Bug