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

Commit 5415bdb

Browse files
committed
Disable keyboard controls when not turned on in settings
1 parent 266813c commit 5415bdb

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
@@ -323,6 +323,9 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
323323
var sourceScope = angular.element(event.target).scope();
324324
var nextOption;
325325
var parent = event.srcElement.parentNode;
326+
if (!$scope.settings.keyboardControls) {
327+
return;
328+
}
326329
if (event.keyCode === 13 || event.keyCode === 32) { // enter
327330
event.preventDefault();
328331
if (!!sourceScope.option) {
@@ -370,6 +373,9 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
370373
$scope.keyDownSearchDefault = function(event) {
371374
var parent = event.srcElement.parentNode.parentNode;
372375
var nextOption;
376+
if (!$scope.settings.keyboardControls) {
377+
return;
378+
}
373379
if (event.keyCode === 9 || event.keyCode === 40) { //tab
374380
event.preventDefault();
375381
setTimeout(function() {
@@ -398,6 +404,9 @@ directiveModule.directive('ngDropdownMultiselect', ['$filter', '$document', '$co
398404

399405
$scope.keyDownSearchSingle = function(event, searchFilter) {
400406
var searchResult;
407+
if (!$scope.settings.keyboardControls) {
408+
return;
409+
}
401410
if ($scope.settings.selectionLimit === 1 && $scope.settings.enableSearch) {
402411
if (event.keyCode === 13) {
403412
searchResult = $filter('filter')($scope.options, searchFilter);

0 commit comments

Comments
 (0)