Replies: 3 comments 4 replies
-
Having the same issue here |
Beta Was this translation helpful? Give feedback.
3 replies
-
Hi @arlyon did you finally find a way to make the combobox work with react-hook-form? I am stuck on it for a while now and I would really appreciate any help. I just posted on StackOverflow as well if thats more useful for giving context. |
Beta Was this translation helpful? Give feedback.
1 reply
-
This seems to have been resolved in ^1.7.14. The onKeyDown={(event) => {
// Listen for enter key
if (event.keyCode === 13) {
// Prevent submission
event.preventDefault();
}
}} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I have a form (as part of a search) for which there is a general purpose search bar, which also triggers a dropdown for autocomplete of predefined tags. I was happy to see that
Combobox
does most of the work! 🚀However, I would like to be able to still use the component predictably in the form, which means triggering the submit when the enter key is pressed (and not currently selecting an item), but the combobox stops propagation unfortunately. Can we support this usecase? Happy to write a PR for it if given the greenlight :) The thought would be to have the event only be stopped if there is a currently selected item.
For context I am using the combobox with a custom component that works with
react-hook-form
, and not providing thevalue
prop to Combobox, so the selected value is not actually displayed in theInput
.Above is some basic code to illustrate the point. We have a general purpose search input box, but when you type, tags are suggested. Selecting a tag will add it to the list, while pressing enter should still submit the form. I can expand it into a proper codepen if you'd like more info.
Required changes have been put in a PR here for illustration purposes: #1176
Cheers,
Alex
Beta Was this translation helpful? Give feedback.
All reactions