-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat(typeahead): Adds 'select on exact' setting. #3365
Conversation
👍 |
2 similar comments
👍 |
👍 |
|
||
* `typeahead-focus-first` | ||
_(Defaults: true)_ : | ||
Should the first match automatically be focused as you type? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason this was moved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I was looking for where to add the documentation for the new attribute, I noticed that they were almost in alphabetical order (except for focus-first) and assumed that they were supposed to be so I moved 'focus-first' to higher up in the list. Looking again, I see I misplaced 'select-on-exact' anyway... so I've fixed that now. I'm happy to order them differently if I'm incorrect.
I like this overall - I am going to schedule this for 0.13.1, since we locked down 0.13.0 for Angular 1.3 compatibility. |
@wesleycho I want to squash this but don't want to destroy history for future reviewer(s). Would you mind if I squash this soon(ish), or should I wait until after it has been reviewed? |
@@ -154,6 +166,11 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position', 'ui.bootstrap | |||
scope.position.top = scope.position.top + element.prop('offsetHeight'); | |||
|
|||
element.attr('aria-expanded', true); | |||
|
|||
//Select the single remaining option if user input matches | |||
if(selectOnExact && scope.matches.length === 1 && inputIsExactMatch(inputValue, 0)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space here after if
I'm fine with squashing now - the merge commits are polluting the history, and would be troublesome to rebase with. |
Squashed. |
While using the typeahead directive, we desired that it automatically select an item when the user input exactly matches the option in the dropdown. This PR is an implementation of this feature.
I called the new attribute typeahead-select-on-exact and it takes a boolean. I've added tests and updated the docs. I tested it locally against IE 10, FF 32, and Chrome 41 using Angular 1.3.13 and 1.2.26.
I also believe this will resolve issue #3310