trevoreyre / autocomplete

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

How to trigger @submit from external button #109

Open maximelebreton opened 4 years ago

maximelebreton commented 4 years ago

Hello @trevoreyre, and thanks for your plugin!

I'm using autocomplete-vue and want to add a "Search" <button>, like on the google page, to trigger the keyboard selected result (or the first if no one is selected):

but I can't find a way to trigger the @submit event from a button!

Precision: the behaviour of this codepen is not what i'm looking for: https://codepen.io/trevoreyre/pen/RwwNKLK?editors=1111

Thanks for your help!

trevoreyre commented 4 years ago

I'm not sure what the difference is between the CodePen example you linked and the Google search behavior. Can you explain a little more?

maximelebreton commented 4 years ago

Yes of course!

Here is a GIF to illustrate the difference: autocomplete

Actual behaviour: On the CodePen example:

Desired behaviour:

I hope to be clearer :)

Thanks!

maximelebreton commented 3 years ago

Hello @trevoreyre, are my explanations clearer?