This repository was archived by the owner on Sep 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
src/components/autocomplete/js Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 input : $element [ 0 ] . getElementsByTagName ( 'input' ) [ 0 ]
1717 } ,
1818 promise = null ,
19- cache = { } ;
19+ cache = { } ,
20+ noBlur = false ;
2021
2122 //-- public variables
2223 self . scope = $scope ;
3435 self . fetch = $mdUtil . debounce ( fetchResults ) ;
3536 self . messages = [ ] ;
3637
38+ //-- While the mouse is inside of the dropdown, we don't want to handle input blur
39+ //-- This is to allow the user to scroll the list without causing it to hide
40+ self . listEnter = function ( ) { noBlur = true ; } ;
41+ self . listLeave = function ( ) { noBlur = false ; } ;
42+
3743 return init ( ) ;
3844
3945 //-- start method definitions
129135 }
130136
131137 function blur ( ) {
132- self . hidden = true ;
138+ if ( ! noBlur ) self . hidden = true ;
133139 }
134140
135141 function keydown ( event ) {
Original file line number Diff line number Diff line change 6363 ng-if="$mdAutocompleteCtrl.loading"\
6464 md-mode="indeterminate"></md-progress-linear>\
6565 </md-autocomplete-wrap>\
66- <ul role="presentation">\
66+ <ul role="presentation"\
67+ ng-mouseenter="$mdAutocompleteCtrl.listEnter()"\
68+ ng-mouseleave="$mdAutocompleteCtrl.listLeave()">\
6769 <li ng-repeat="(index, item) in $mdAutocompleteCtrl.matches"\
6870 ng-class="{ selected: index === $mdAutocompleteCtrl.index }"\
6971 ng-show="searchText && !$mdAutocompleteCtrl.hidden"\
You can’t perform that action at this time.
0 commit comments