Choices
Choices copied to clipboard
highlightItem always shows dropdown
Describe the bug The highlightItem event always shows the dropdown. I'd like a reliable way to always hide dropdown when this event is triggered.
To Reproduce I have a multi select input.
I added the following event listener to hide the dropdown on highlightItem:
selectElement.addEventListener('highlightItem', function() { choices.hideDropdown(); });
When I highlight an item the dropdown is hidden but then immediately shown again.
Expected behavior With the above event listener, I expect the dropdown to be hidden (or stay hidden) whenever an item is highlighted.
As a workaround I have added setTimeout(function(){choices.hideDropdown();}, 0);
to the event listener (to hide the dropdown a second time after a short delay). While this works you there is a noticeable flash as the dropdown appears and then disappears.