Skip to content

Commit 4d3c739

Browse files
committed
turn off focuses on ios devises
1 parent bc3de20 commit 4d3c739

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

dist/select.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ if (angular.element.prototype.closest === undefined) {
9494

9595
var latestId = 0;
9696

97+
var isIos = 0;
98+
99+
if ( /iphone|ipod|ipad/.test( window.navigator.userAgent.toLowerCase()) ) {
100+
isIos = 1;
101+
}
102+
97103
var uis = angular.module('ui.select', [])
98104

99105
.constant('uiSelectConfig', {
@@ -324,11 +330,10 @@ uis.controller('uiSelectCtrl',
324330
if ( ctrl.activeIndex === -1 && ctrl.taggingLabel !== false ) {
325331
ctrl.activeIndex = 0;
326332
}
327-
328333
// Give it time to appear before focus
329334
$timeout(function() {
330335
ctrl.search = initSearchValue || ctrl.search;
331-
ctrl.searchInput[0].focus();
336+
if ( !isIos ) ctrl.searchInput[0].focus();
332337
});
333338
}
334339
};
@@ -562,7 +567,7 @@ uis.controller('uiSelectCtrl',
562567
ctrl.select(undefined);
563568
$event.stopPropagation();
564569
$timeout(function() {
565-
ctrl.focusser[0].focus();
570+
if ( !isIos) ctrl.focusser[0].focus();
566571
}, 0, false);
567572
};
568573

@@ -1546,7 +1551,7 @@ uis.directive('uiSelectSingle', ['$timeout','$compile', function($timeout, $comp
15461551
scope.$on('uis:close', function (event, skipFocusser) {
15471552
$timeout(function(){
15481553
$select.focusser.prop('disabled', false);
1549-
if (!skipFocusser) $select.focusser[0].focus();
1554+
if ( !isIos && !skipFocusser ) $select.focusser[0].focus();
15501555
},0,false);
15511556
});
15521557

0 commit comments

Comments
 (0)