designsystemet
designsystemet copied to clipboard
Combobox - Cannot reset controlled combobox
Description of the bug
I extended the controlled combobox example (codeexample from here) with a new button: Nullstill.
The button is quite simple, and sets the value of the combobox to an empty array.
<Button
onClick={() => {
setValue([])
}}
style={{ marginBottom: '1rem' }}
>
Nullstill
</Button>
I expect the combobox to be reset when clicking on the button, just as when the user clicks on the clear button.
However, the combobox does not get fully reset. The options are gone, but the value is still present in the input field.
See the video for an example.
https://github.com/user-attachments/assets/fe53fc0d-f2ca-4ded-8857-aa5e337a7af9
Steps To Reproduce
- Extend the "Controlled combobox storybook example" with a new button: Reset
- Update value to an empty array in Reset buttons onClick handler
Additional Information
No response