-
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 retains invalid option after typing and clicking enter #8170
Comments
Issue #6102 and this issue #8170 are related. Both are good options and should be supported. The caveat for retaining a value is the need for validation to ensure the retained value is good. Further along the lines of what the user can type in...., we should have a way to always validate what is typed in. |
I created this CodeSandbox showing the attempt I made at addressing this issue. Eventually, I did get it to work by TOGGLING selectedItem (this is a hokey fix). I would have much preferred to use the downshift prop onStateChange but Carbon has its own onStateChange and ignores ComboBox.downshiftProps.onStateChange. I logged feat(ComboBox) ComboBox need more/better support of downshift for better ComboBox downshift support. |
Hi! can this fix be ported to Angular as well? Screen.Recording.2022-01-28.at.4.40.49.PM.movLet me know if I should open a separate bug for this or not or how to proceed. |
Title line template: ComboBox retains invalid option after typing and clicking enter
What package(s) are you using?
carbon-components
carbon-components-react
Detailed description
Issue #6818 ComboBox doesn't support entry of Text not found in list items may be effected by this.
#6818 specifically mentions enter - but enter and click away should both be taken into account.
Steps to reproduce the issue
The ComboBox now looks like you selected a valid option of "YYY", but "YYY" is not a valid option.
Side note:
When the ComboBox is in this state - showing an option that does not match an item - clicking on the Combobox will show the drop down list and have the previous selected item still checked.
Essentially showing 'YYY' but having 'Option 1' still being the real selected item.
Additional information
ComboBox.demo.mov
Attempted workaround
I created this CodeSandbox showing the attempt I made at addressing this issue.
But is does not work, the re-setting value does not work.
If anyone has any comments/suggestions how to fix this please let me know.
https://codesandbox.io/s/combobox-fix-enter-kpdne
The text was updated successfully, but these errors were encountered: