trevoreyre / autocomplete

Accessible autocomplete component for vanilla JavaScript and Vue.
https://autocomplete.trevoreyre.com
MIT License
434 stars 75 forks source link

onUpdate fires everywhere #138

Open kilianso opened 2 years ago

kilianso commented 2 years ago

Hey there

Very useful package! I'm using it together with the Mapbox Geocoding API to fetch and display locations. One problem i have is that the focus event keeps triggering an API call even though a result has already been selected. So why not just keeping the previous results in a variable and show them in a list on focus but only listen to the change event to update that list?

UPDATE: I just realized, that the onUpdate event triggers everywhere. You can click where ever you want on the document and it triggers an update. Can be easily reproduced by putting a console log in the onUpdate method.