Looks like using mousedown rather than click on the ul might work around the issue.
However, per https://adamsilver.io/blog/building-an-accessible-autocomplete-control/, a better approach might be to:
- add a keydown handler on the input that closes the dropdown when the user tabs away from the input - add a document-level click handler that hides the drop-down if the users clicks outside of it - add something similar for touch events
Looks like using mousedown rather than click on the ul might work around the issue.
However, per https:/ /adamsilver. io/blog/ building- an-accessible- autocomplete- control/, a better approach might be to:
- add a keydown handler on the input that closes the dropdown when the user tabs away from the input
- add a document-level click handler that hides the drop-down if the users clicks outside of it
- add something similar for touch events