Skip to content
This repository was archived by the owner on Dec 16, 2019. It is now read-only.

Commit b7ad4a1

Browse files
committed
Merge branch 'Fix-1.2.0' into Fix-1.3.0
* Fix-1.2.0: Disable keyboard controls when not turned on in settings
2 parents 36771bc + 5415bdb commit b7ad4a1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/angularjs-dropdown-multiselect.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
332332
var sourceScope = angular.element(event.target).scope();
333333
var nextOption;
334334
var parent = event.srcElement.parentNode;
335+
if (!$scope.settings.keyboardControls) {
336+
return;
337+
}
335338
if (event.keyCode === 13 || event.keyCode === 32) { // enter
336339
event.preventDefault();
337340
if (!!sourceScope.option) {
@@ -379,6 +382,9 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
379382
$scope.keyDownSearchDefault = function(event) {
380383
var parent = event.srcElement.parentNode.parentNode;
381384
var nextOption;
385+
if (!$scope.settings.keyboardControls) {
386+
return;
387+
}
382388
if (event.keyCode === 9 || event.keyCode === 40) { //tab
383389
event.preventDefault();
384390
setTimeout(function() {
@@ -407,6 +413,9 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
407413

408414
$scope.keyDownSearchSingle = function(event, searchFilter) {
409415
var searchResult;
416+
if (!$scope.settings.keyboardControls) {
417+
return;
418+
}
410419
if ($scope.settings.selectionLimit === 1 && $scope.settings.enableSearch) {
411420
if (event.keyCode === 13) {
412421
searchResult = $filter('filter')($scope.options, searchFilter);

0 commit comments

Comments
 (0)