Search and Selecting Option Sometimes Does Not Select Option
Opened this issue · 6 comments
We've noticed a bug when using this plugin when using a single select in combination with the search property. Sometimes, when using the search function to narrow down to a single result, clicking the option will close the dropdown without selecting the option.
We've noticed this happens in tandem with some listeners, so it's not completely isolated. Here's the general flow of it:
- Options are populated via an API call from a listener on a different field
- The user searches for the desired option
- The user selects the option
- A listener is fired off. This listener does the following (in order)
- Options are remade (but not populated yet) due to some business logic
- The listener is temporarily removed
- The options are re-set using
setOptions
. To ensure no stale data, thekeepValue
argument is not set. - The option that was originally selected when the listener was fired is re-set using the
setValue
method. ThedisableEvent
argument istrue
- The listener is added back
@mnorthern2 could you provide a replication sample?
The reproduction I currently have is proprietary for my company. I'll work on isolating an example though!
I will note that this definitely has something to do with some sort of listener. On other, simpler pages, the same functionality works with no issue.
@gnbm I got around to creating a replication sample!
https://gist.github.com/mnorthern2/ded731f34eb11a6b2917ef0f61db9a30
Replication steps:
- Load the gist
- Wait for the second dropdown to load its options
- Search for any option (options are labeled
Option i
wherei
is a number between 1 and 10 - Click on the resulting option (using the keyboard works as expected)
- Note that the option was not selected
I have not checked other browsers, so for completeness, this is using Chrome.
Just commenting to make it known that this is still an issue/keep the issue from automatically locking.
@mnorthern2 I am facing exactly the same issue, any work around you found so far?
This is happening only in case of single select dropdown with search option enabled.
@mnorthern2 I am facing exactly the same issue, any work around you found so far?
This is happening only in case of single select dropdown with search option enabled.
I unfortunately have not. I traced some of the source code at one point and I believe it was an issue with an event listener, but that'd require modifying the library manually.