rob-balfre / svelte-select

Svelte Select. A select component for Svelte
https://svelte-select-examples.vercel.app
Other
1.26k stars 175 forks source link

Add keypress event in the searchbox #445

Open caleidon opened 1 year ago

caleidon commented 1 year ago

I'd love if you could add an event for when a key is pressed in the search box. I use your plugin as an autosuggest list and as a search box at the same time, and there is no way for me to know when a user types something in the search box other than using bind:filterText and then listening to the changes.

The downside with that is that I can't recieve the InputEvent and I can't use e.code to see if ENTER was pressed when searching, where I want to do some additional functionality. Is this something you could add?

Something like: on:keyDown={(e: InputEvent) => console.log(e)}

fsoft72 commented 10 months ago

Please, expose also on:keyup and on:keypress because I'd like to filter user keys before them being added to the input box / search filter