atom / atom-select-list

An etch component to show select lists with fuzzy filtering, keyboard navigation and other cool features.
MIT License
33 stars 33 forks source link

Support configurable auto-selection #10

Closed lexicalunit closed 7 years ago

lexicalunit commented 7 years ago

I'd like to use this component, but I need to be able to configure it to select nothing by default. When filtering it should still filter items just the same, but just don't automatically select the first item in the list after each filtering process has completed. Pressing enter when there are items in the list, but none are selected, should result in didConfirmEmptySelection() being called.

My existing use case for this is a list of existing documents. While typing out a query, it filters the document list to show relevant matches. However, as long as no document is yet selected, confirmation will create a new document with name set to the current query filter. It's this last part that can't be done with atom-select-list as it's currently written.

lexicalunit commented 7 years ago

Perhaps a concrete example can help make things more clear. You can see my use case in action via #11 in atom-notes. Notice the difference between pulling up the atom-notes modal vs. the fuzzy-finder modal or even the command-palette modal.

Fuzzy Finder

Automatically selects the first item on the list:

fuzzy-finder

Atom Notes

Does not automatically select anything:

atom-notes