-
Notifications
You must be signed in to change notification settings - Fork 6.7k
typeahead list - don't auto select / highlight first item #908
Comments
@thnk2wn I see your use. How would you imagine API for hooking into the typeahead? Feel free to send a PR with the suggested code. |
Maybe a true/false attribute something like typeahead-auto-highlight="false". Substituting highlight for select or focus if more clear. Defaults to true. It may be a bit before I can return to this issue but I can attempt changes, pull request later perhaps. Thanks |
I'll take note of this as I work on #888. Gathering more use cases of hooking into controller and what behavior people could possibly want to customize. |
That would be great if we could have a way to choose which result to highlight on popup. That goes with the option of "none" as @thnk2wn mentioned. That way the user can choose whether or not he wants to use the typeahead list to validate his input field.
For now if you have any quick&dirty fix I would gladly take them. |
+1. I also want to allow the user to press enter to take them to a full search page. |
@Virtual-Dev @emosenkis have a look at issue #1298 |
+1 for the behaviour that virtual-dev describes. This is in fact the same default behaviour of the jquery-ui autocomplete widget: http://jqueryui.com/autocomplete/ |
👍 for not selecting first item.. or making it optional (and defaults for true) |
👍 this feature is much needed. |
+1 |
Is the OP asking for a feature or for a bug to be fixed? To me, the current behavior of typeahead is buggy. If the data array of typeahead contains item "Photography" then you can no longer add item "Photo" to the input box because as soon as you start typing "photo", "Photography" item will be selected. Now, when you press enter, it'll submit "Photography". You can get around that if you have an actual submit button on the input field, which you can press with your mouse to get around this bug. |
It's a current feature, which this (#908) issue is in favor of limiting, or |
👍 I can't help but to append my request for this highlightening to become optional |
OK guys, I've just went over various implementations of autocomplete / typeaheads widgets and it is true that most of them do not higlight / select first match by default. The current behaviour is simply consistent with the behaviour of the original typeahead widget from Bootstrap2.x. But I understand your point. Here is my proposal: since the typeahead has 2 modes:
How does it sound? |
@chrisirhc from the last hangout I remember that you've got quite a lot on your plate (animations, typeahead ctrl, tooltips). Maybe we should split this between ourselves? |
@pkozlowski-opensource sounds reasonable to me! |
Yeah, it would be great
|
@pkozlowski-opensource |
@pkozlowski-opensource I agree with editable => do not highlight / non-editable => highlight |
@pkozlowski-opensource This would be a great a feature. Look forward to seeing it implemented. |
@pkozlowski-opensource Yes please for editable: no default, non-editable: highlight! |
+1, please! |
+1, i definitly need this. |
+1! |
+1.. we may have to fork until we have this! Thanks for all your work so far, it's been great! |
+1 |
1 similar comment
+1 |
a very very ugly quickfix in the HTML would be:
|
+1 - need this for my app as well. |
Seeing as it has been almost a year with no traction on this I implemented the following workaround in ui-bootstrap-tpls-0.10.0.js under In getMatchesAsync: if (inputValue === modelCtrl.$viewValue && hasFocus) {
if (matches.length > 0) {
//<CUSTOM>
//scope.activeIdx = 0;
scope.activeIdx = -1;
//</CUSTOM> and inside else if (evt.which === 13 || evt.which === 9) {
scope.$apply(function () {
if (scope.activeIdx != -1) { //<CUSTOM>
scope.select(scope.activeIdx);
} // </CUSTOM>
}); |
I also needed the ability to not auto select the first option. I have a version that allows tabbing out of the current input field still keeps the model updated with the current view value. I'll circle back and try to correct the tests. rickschmidt@371d1af |
Fixing autoselect based on comments @ angular-ui#908 (comment)
I made a decorator that can add will prevent the first item from being auto-selected. It's a hack until a native solution is added, but I prefer it over manually editing the ui-bootstrap code.
|
Any ETA on releasing this feature ? |
+1 |
3 similar comments
+1 |
+1 |
+1 |
+1. And hat tip to @Illniyar for generously sharing. |
+1. Thanks, @Illniyar for the workaround, but this really needs to be fixed in the component. |
+1. And thanks for the workarounds in the meantime. |
+1 |
3 similar comments
+1 |
+1 |
+1 |
Just submitted pull request #2916 to add option for |
Urgent here Would like to thank @msafi for providing a link to such a clever and efficient work around. |
Add typeahead-focus-first option to prevent first match from being focused. Currently, the first result is automatically focused as you type. Now, set `typeahead-focus-first="false"` and the first result is *not* automatically focused as you type. Closes angular-ui#908 Closes angular-ui#2916
+11 |
@ionox0, please do not simply add |
+1 shows that there is additional people that would use the same solution if it was provided, how is this a bad thing. To be specific, I would use it to allow for our search to just jump to the advanced search vs. having an autocomplete jumping to a page or other filtered advanced search based on the selected value (click on, not Enter). Enter would just "do a search" |
https://codepen.io/Artistan/pen/LywrXj This makes a dataset based on the current input query be the first option. |
Need a way to be able to not auto "select" / highlight the first match in the typeahead list. There are workarounds for direct use of bootstrap such as below. We can make custom changes in our copy of angular ui bootstrap typeahead but then we can't easily upgrade later.
http://stackoverflow.com/questions/9564977/bootstrap-typeahead-dont-autoselect-first-item
http://bibwild.wordpress.com/2013/04/04/overriding-bootstrap-typeahead-to-not-initially-select/
The text was updated successfully, but these errors were encountered: