Closed yhnavein closed 3 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/tbleckert/react-select-search/7n61f7i77
✅ Preview: https://react-select-search-git-fix-button-type.tbleckert.vercel.app
Nice catch, I noticed this and came here to check if somebody has tackled this before me. =)
Nice! Great work @yhnavein . I'll merge this in and publish a patch later today. Let's put a hold on the optional chaining thing. I can imagine there's more places we could utilize it anyways, so we can pick up the conversation at a later stage.
By default options in the Select are rendered as
button
without antype
attribute, which defaults totype="submit"
. Normally it's not a problem, because in most cases Search dropdown is rendered directly in the document body (outside of any forms), but if you choose to userender="always"
then it starts to be a problem. Then list elements will behave as actual submit buttons. This is very bad.I've added
type="button"
as this is a proper value in this case.