#Open select input on Button click
8 messages · Page 1 of 1 (latest)
get input ref, call inputRef.current.click()
No idea then, used to work before
In the source code, I see that opening occurs in the onMouseDown event. So the following code works form me:
selectRef.current.dispatchEvent(
new MouseEvent("mousedown", { bubbles: true })
);
And to automatically close the select after clicking it, call focus() on input.
I replaced sandbox.
Hey @shut thorn - do you know how to close it programatically as well?
Maybe "mouseup" event?
Hmm, sounds like it could work - I'll try that out, thanks