Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 04a21e3

Browse files
Charurupkozlowski-opensource
authored andcommittedJun 8, 2013
fix(typeahead): return focus to the input after selecting a suggestion
Currently focus is lost if you mouse click on the suggestions model instead of using the keyboard. This keeps the focus.
1 parent 67e9d23 commit 04a21e3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/typeahead/typeahead.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,13 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position'])
152152
model = parserResult.modelMapper(scope, locals);
153153
modelCtrl.$setViewValue(model);
154154
modelCtrl.$render();
155-
156155
onSelectCallback(scope, {
157156
$item: item,
158157
$model: model,
159158
$label: parserResult.viewMapper(scope, locals)
160159
});
160+
161+
element[0].focus();
161162
};
162163

163164
//bind keyboard events: arrows up(38) / down(40), enter(13) and tab(9), esc(27)
@@ -244,4 +245,4 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position'])
244245
return function(matchItem, query) {
245246
return query ? matchItem.replace(new RegExp(escapeRegexp(query), 'gi'), '<strong>$&</strong>') : query;
246247
};
247-
});
248+
});

0 commit comments

Comments
 (0)
This repository has been archived.