|
167 | 167 | var ctrl = this;
|
168 | 168 |
|
169 | 169 | var EMPTY_SEARCH = '';
|
| 170 | + var scrollFlag = false; //marks if the 'mouseover' event is triggered by the _ensureHighlightVisible function call which controls the scrolling. stopPropagation if so |
170 | 171 |
|
171 |
| - ctrl.placeholder = undefined; |
| 172 | + |
| 173 | + ctrl.placeholder = undefined; |
172 | 174 | ctrl.search = EMPTY_SEARCH;
|
173 | 175 | ctrl.activeIndex = 0;
|
174 | 176 | ctrl.activeMatchIndex = -1;
|
|
195 | 197 | };
|
196 | 198 |
|
197 | 199 | var _searchInput = $element.querySelectorAll('input.ui-select-search');
|
| 200 | + var dropdownEle = _searchInput[0].parentNode; |
| 201 | + |
198 | 202 | if (_searchInput.length !== 1) {
|
199 | 203 | throw uiSelectMinErr('searchInput', "Expected 1 input.ui-select-search but got '{0}'.", _searchInput.length);
|
200 | 204 | }
|
|
787 | 791 | }
|
788 | 792 | });
|
789 | 793 |
|
790 |
| - _searchInput.on('tagged', function() { |
791 |
| - $timeout(function() { |
| 794 | + _searchInput.on('tagged', function () { |
| 795 | + $timeout(function () { |
792 | 796 | _resetSearchInput();
|
793 | 797 | });
|
794 | 798 | });
|
795 | 799 |
|
796 |
| - _searchInput.on('blur', function() { |
797 |
| - $timeout(function() { |
| 800 | + _searchInput.on('blur', function () { |
| 801 | + $timeout(function () { |
798 | 802 | ctrl.activeMatchIndex = -1;
|
799 | 803 | });
|
800 | 804 | });
|
801 | 805 |
|
| 806 | + // capture the mouseover event before it propagates to child nodes |
| 807 | + dropdownEle.addEventListener('mouseover', function (e) { |
| 808 | + if (scrollFlag) { |
| 809 | + e.preventDefault(); |
| 810 | + e.stopPropagation(); |
| 811 | + } |
| 812 | + scrollFlag = false; |
| 813 | + }, true); |
| 814 | + |
802 | 815 | function _findCaseInsensitiveDupe(arr) {
|
803 | 816 | if ( arr === undefined || ctrl.search === undefined ) {
|
804 | 817 | return false;
|
|
854 | 867 | var height = container[0].offsetHeight;
|
855 | 868 |
|
856 | 869 | if (posY > height) {
|
| 870 | + scrollFlag = true; |
857 | 871 | container[0].scrollTop += posY - height;
|
858 | 872 | } else if (posY < highlighted.clientHeight) {
|
| 873 | + scrollFlag = true; |
859 | 874 | if (ctrl.isGrouped && ctrl.activeIndex === 0)
|
860 | 875 | container[0].scrollTop = 0; //To make group header visible when going all the way up
|
861 | 876 | else
|
|
1235 | 1250 |
|
1236 | 1251 | choices.attr('ng-repeat', RepeatParser.getNgRepeatExpression($select.parserResult.itemName, '$select.items', $select.parserResult.trackByExp, groupByExp))
|
1237 | 1252 | .attr('ng-if', '$select.open') //Prevent unnecessary watches when dropdown is closed
|
1238 |
| - .attr('ng-mouseenter', '$select.setActiveItem('+$select.parserResult.itemName +')') |
| 1253 | + // change ng-mouseenter to ng-mouseover because 'mouseenter' event does not bubble and cannot be captured by parent node |
| 1254 | + .attr('ng-mouseover', '$select.setActiveItem('+$select.parserResult.itemName +')') |
1239 | 1255 | .attr('ng-click', '$select.select(' + $select.parserResult.itemName + ',false,$event)');
|
1240 | 1256 |
|
1241 | 1257 | var rowsInner = element.querySelectorAll('.ui-select-choices-row-inner');
|
|
0 commit comments