-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Typeahead: Allow controlling selection trigger keys #5671
Comments
This request has accessibility ramifications - can you explain why do you want it to close the typeahead without selecting on tab? |
Our form has multiple fields. We'd like our input to allow both free-form entry as well as selection from a list. In order to allow consistent navigation between form fields, we'd like to make it so that Just to clarify: this request is not to change the default behavior, but specifically to allow the option to prevent |
@wesleycho Any further thoughts on this feature idea? Or perhaps a simple workaround? I'll begin working on a workaround this week or next. It seems |
@christor I believe you could accomplish what you want today by using Would you not be able to check which key was pressed on the event object and handle different logic accordingly? |
@deeg Thanks. That doesn't quite work because by the time the callback is made the value has already been replaced in the input field. I can't simply So the best I could think do without modifying |
Thanks, I'll give that a shot. For my use case I do not want to restrict the user to the choices in the |
+1 |
Please do not post +1s, it adds noise to the issue thread. |
My earlier reply about Unless I've misunderstood, it doesn't appear to suit my need since I need to allow a custom value to be entered that isn't on the list. |
Here's a plunker with a workaround that comes close to the behavior I'm looking for: http://plnkr.co/edit/jtKEcKLN5RGDrldb31Gd?p=preview It saves the current model on keyup, then on keydown with a If it's unlikely a patch to add an option to change the behavior will be accepted, I'll use this work-around. If a patch would be considered, I'll work on something today. |
By default behaves as before. If specified, allows a custom function to be defined to determine whether the keydown event should trigger selection Closes angular-ui#5671
By default behaves as before. If specified, allows a custom function to be defined to determine whether the keydown event should trigger selection. Closes angular-ui#5671
Currently, typeahead treats either a
Tab
orEnter
key as a trigger to select the currently-highlighted option. This is probably a sensible default for many use cases.I have a particular use case where I'd like to make it so that a tab does not trigger selection, but instead simply moves to the next form field. For my use case, a simple
typeahead-select-on-tab="false"
or something similar would suffice.A more general thought might be to allow arbitrary keys/combinations to trigger completion, or a callback function for determining this (something like
typeahead-is-trigger-key="vm.isTriggerKey($event)"
).Before I go off generating a pull request...Is there some support for something like that that already exists? Any thoughts on the idea? Implementation/naming?
The text was updated successfully, but these errors were encountered: