File tree Expand file tree Collapse file tree 1 file changed +9
-16
lines changed Expand file tree Collapse file tree 1 file changed +9
-16
lines changed Original file line number Diff line number Diff line change @@ -562,32 +562,25 @@ uis.controller('uiSelectCtrl',
562
562
563
563
function _handleDropDownSelection ( key ) {
564
564
var processed = true ;
565
- var tempIndex ;
565
+ var idx ;
566
566
switch ( key ) {
567
567
case KEY . DOWN :
568
568
if ( ! ctrl . open && ctrl . multiple ) ctrl . activate ( false , true ) ; //In case its the search input in 'multiple' mode
569
569
else if ( ctrl . activeIndex < ctrl . items . length - 1 ) {
570
- do {
571
- tempIndex = ctrl . activeIndex + 1 ;
572
- if ( tempIndex < ctrl . items . length )
573
- {
574
- ctrl . activeIndex = tempIndex ;
575
- }
570
+ idx = ++ ctrl . activeIndex ;
571
+ while ( _isItemDisabled ( ctrl . items [ idx ] ) && idx < ctrl . items . length ) {
572
+ ctrl . activeIndex = ++ idx ;
576
573
}
577
- while ( _isItemDisabled ( ctrl . items [ tempIndex ] ) && tempIndex < ctrl . items . length && tempIndex ++ ) ;
578
574
}
579
575
break ;
580
576
case KEY . UP :
577
+ var minActiveIndex = ( ctrl . search . length === 0 && ctrl . tagging . isActivated ) ? - 1 : 0 ;
581
578
if ( ! ctrl . open && ctrl . multiple ) ctrl . activate ( false , true ) ; //In case its the search input in 'multiple' mode
582
- else if ( ctrl . activeIndex > 0 || ( ctrl . search . length === 0 && ctrl . tagging . isActivated && ctrl . activeIndex > - 1 ) ) {
583
- do {
584
- tempIndex = ctrl . activeIndex - 1 ;
585
- if ( tempIndex >= 0 )
586
- {
587
- ctrl . activeIndex = tempIndex ;
588
- }
579
+ else if ( ctrl . activeIndex > minActiveIndex ) {
580
+ idx = -- ctrl . activeIndex ;
581
+ while ( _isItemDisabled ( ctrl . items [ idx ] ) && idx > minActiveIndex ) {
582
+ ctrl . activeIndex = -- idx ;
589
583
}
590
- while ( _isItemDisabled ( ctrl . items [ tempIndex ] ) && tempIndex >= 0 && tempIndex -- ) ;
591
584
}
592
585
break ;
593
586
case KEY . TAB :
You can’t perform that action at this time.
0 commit comments