i-like-robots / react-tag-autocomplete

⚛️ A simple, accessible, tagging component ready to drop into your React projects (new repo)
https://i-like-robots.github.io/react-tag-autocomplete/
ISC License
178 stars 12 forks source link

DelimeterKeys doesn't work when selected value is empty array #63

Closed mikalai-sauchanka closed 9 months ago

mikalai-sauchanka commented 10 months ago

DelimeterKeys doesn't work until at least one tag has been added by clicking the dropdown. Here's an example: https://codesandbox.io/p/sandbox/react-tag-autocomplete-6l43qm?file=%2Fsrc%2FApp.js

i-like-robots commented 10 months ago

Thanks for sharing the demo @mikalai-sauchanka

When the allowNew prop is enabled a new tag can only be created when selecting the new tag option from the listbox. In the code you provided the new tag option remains selected after adding the first tag. If you'd like to reset the listbox state after adding a tag you can use the collapseOnSelect option.