Open MegaMech opened 1 year ago
I am also stuck on this issue. Can anybody please help with some solution?
cc: @JedWatson @gwyneplaine
I have found the solution. We need to dispatch mousedown
event on the dropdown indicator in select to programmatically opening (with DOM usage) the menu and choosing the option.
Sample Code:
let dropdownIndicator = document.querySelector("div#react-select-container > div > div.react-select__indicators > div");
dropdownIndicator.dispatchEvent(new MouseEvent('mousedown', { bubbles: true }));
id is preferred over class for detection of element and bubbling of the event is important for menu to open.
@MegaMech , can you use JS for your use case?
I need to automate form data input, but I'm having issues finding a way to select an option with a react-select component. Browser extensions are not able to access react properties due to security sandboxing. As such only in dev tools can I use select->control->reactProps->...->setvalue().
Is it possible to fix the react-select bug that prevents
e.click()
from opening the drop-down list and then selecting one of the options also using e.click()?