-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ComboBox doesn't support entry of Text not found in list items #6818
Comments
Have you tried looking in the Downshift docs to see if there is an event you can hook in to? Wondering if we need to update our downshift dependency, found this recent issue downshift-js/downshift#1150 |
Thanks -- I wasn't really aware of the Downshift docs -- I only saw a reference to downshift-1-title that was needed to be set to update the title of the ComboBox... I think the ComboBox object should support something like an onSubmit to get whatever text was entered (e.g., without needing to know about Downshift at all). Or perhaps having onChange reporting what was in the input box when Enter was pressed. My usecase is to provide a list of known choices to replace part of a sentence, but to allow the user to type in something not in the list and use that as the replacement if they press Enter. So, in my case if my list had phone numbers: +1 860 812 5089 and 8608125089, and the person selected the first item and then edited it to remove the "+1 " and pressed Enter, I'd want to know they wanted me to use "860 812 5089" as the replacement text. |
It would be nice if the component supported all methods related to its capabilities, like a setTitle, setRows, etc rather than having to rely on inner components (like having to set the value of the downshift-1-title element). |
I've zipped up my code to try to help show the problems with onChangeInput, etc. If you yarn start run in the js directory, you'll get a modal with a combo box, two text fields, and two buttons. The goal of the dialog is to allow users to update If you type Junk into the combo box text field and then press Enter you'll see the However, if I want to edit my selection (e.g., to remove the +1 from the +1 860 742 5185 to result in the value being just 860 742 5185 I can't get this to work. Also note the onInputChange fires twice when ENTER is pressed. I think the onInputChange event should report the value and the keyState so we can know if ENTER was pressed (or perhaps there should be an onSubmit for the ComboBox. It would be nice to be able to set the id for the buttonPrimary and buttonSecondary so we aren't dependent on your class names. These are the files in the js.zip attached: After unzipping, cd js then run yarn install to build the node_modules needed... Note: I ended up having to maintain my own state variables so I could process updates synchronously as the async updates to this.state were not occurring in a way I could reference their updated state. |
ComboBox has onInputChange but no way to know when Enter is pressed
Though documentation claims the ComboBox allows people to enter text not found in the list items, there is no notification that this has occurred. There should be an onSubmit method to allow capture of Text that was in the input field when enter was pressed. If text matches a list item, that becomes selected and onChange is fired.
What package(s) are you using?
Detailed description
The text was updated successfully, but these errors were encountered: