yairEO / tagify

🔖 lightweight, efficient Tags input component in Vanilla JS / React / Angular / Vue
https://yaireo.github.io/tagify/
Other
3.55k stars 436 forks source link

Fix dropdown stays open and keeping focus #1407

Closed Massi-X closed 1 week ago

Massi-X commented 1 week ago

Hi @yairEO I will push a bit of PRs in the coming days to fix some annoying issues I found, so I'm keeping descriptions short. If you have any question fell free to ask.

This PR fixes the dropdown staying open in some rare cases even when clicking outside the tagify instance. See jsbin, if you wiggle around a bit (choose a value, delete the input using the keyboard only, choose another with keyboard, now try to click outside with mouse) you will eventually occur in the bug. Sometimes you may be lucky and get the bug at the first mouse click.

Edit: Add also related commit regarding the input not losing the focus border when navigating with Tab. To reproduce: Navigate with Tab over the input, you'll see that the focus class is not removed. This happens because in the code we are updating the focus state only when it is true, and not when is false.