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

Commit

Permalink
fix(typeahead): return focus to the input after selecting a suggestion
Browse files Browse the repository at this point in the history
Currently focus is lost if you mouse click on the suggestions model instead of using the keyboard. This keeps the focus.
  • Loading branch information
Charuru authored and pkozlowski-opensource committed Jun 8, 2013
1 parent 67e9d23 commit 04a21e3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/typeahead/typeahead.js
Expand Up @@ -152,12 +152,13 @@ angular.module('ui.bootstrap.typeahead', ['ui.bootstrap.position'])
model = parserResult.modelMapper(scope, locals);
modelCtrl.$setViewValue(model);
modelCtrl.$render();

onSelectCallback(scope, {
$item: item,
$model: model,
$label: parserResult.viewMapper(scope, locals)
});

element[0].focus();
};

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

0 comments on commit 04a21e3

Please sign in to comment.