Skip to content

Commit

Permalink
fix: ensure highlighted before selecting on tab
Browse files Browse the repository at this point in the history
- Ensure at least one item is highlighted before selecting on tab keypress

Closes angular-ui#1030
  • Loading branch information
jintoppy authored and fcaballero committed Apr 25, 2016
1 parent b5f09cb commit 6f47a3d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/uiSelectController.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,9 @@ uis.controller('uiSelectCtrl',
else if (ctrl.activeIndex > 0 || (ctrl.search.length === 0 && ctrl.tagging.isActivated && ctrl.activeIndex > -1)) { ctrl.activeIndex--; }
break;
case KEY.TAB:
if (!ctrl.multiple || ctrl.open) ctrl.select(ctrl.items[ctrl.activeIndex], true);
if ((!ctrl.multiple || ctrl.open) && ctrl.activeIndex >=0) {
ctrl.select(ctrl.items[ctrl.activeIndex], true);
}
break;
case KEY.ENTER:
if(ctrl.open && (ctrl.tagging.isActivated || ctrl.activeIndex >= 0)){
Expand Down

0 comments on commit 6f47a3d

Please sign in to comment.