Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added configurable submitKeys #17058

Open
wants to merge 3 commits into
base: gh-pages
Choose a base branch
from
Open

Conversation

mirbuf
Copy link

@mirbuf mirbuf commented Apr 11, 2017

Instead of default Enter key, any number of keys can be configured via optional submitKeys: [] array.
Defaults to Comma, Tab and Enter keys.

@LeaVerou
Copy link
Owner

Thank you for working on this! I like the flexibility of being able to specify your own keys, that is very on par with Awesomplete's design principles.
However, I still think Enter should be the default. Tab can interfere with tabbing through form controls, and comma could interfere when your actual options contain commas.

@AetherUnbound
Copy link

This seems like a great feature, but I agree that having it as default might be problematic. Perhaps it might be made more configurable, i.e. submitKeys initially only contains the enter key but there might also be a method to add one's own preferred default keys.
For instance, we hope to use awesomplete for entering directories. Tabs would be great for that, but perhaps not commas.

@mirbuf
Copy link
Author

mirbuf commented Apr 14, 2017

I added submitKeys defaulted that way as a PoC. I agree that could be left just Enter, or Enter + Tab as default keys. And a method to set the new option would be a nice addition. I'll eventually add it, later.

@mirbuf
Copy link
Author

mirbuf commented Apr 26, 2017

LeaVerou, I set default submitKeys to [ Enter ].
I also added a method to set user own submitKeys. You can:

setSubmitKeys( KEYCODE )
setSubmitKeys( [ KEYCODE1, ... , KEYCODEn ] )
setSubmitKeys( 'aeiou' ) // this will set 'A', 'E', 'I', 'O', 'U' keys keycodes

Let me know if this may be a more useful addition.

@LeaVerou
Copy link
Owner

Why do we need a function (and such a long one at that)? People can modify the submitKeys array, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants