From cb4a3a799e62fbf8e1ceec909e5cb494a329d0ef Mon Sep 17 00:00:00 2001 From: mabashian Date: Mon, 7 Oct 2019 11:28:51 -0400 Subject: [PATCH] Prevent usage of mousewheel on spinner elements --- awx/ui/client/src/shared/directives.js | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/awx/ui/client/src/shared/directives.js b/awx/ui/client/src/shared/directives.js index 32fc9a0f11..5ae425309b 100644 --- a/awx/ui/client/src/shared/directives.js +++ b/awx/ui/client/src/shared/directives.js @@ -1059,18 +1059,22 @@ function(SettingsUtils, i18n, $rootScope) { up: "Form-numberInputButton fa fa-angle-up" }, spin: function(e, u) { - ctrl.$setViewValue(u.value); - ctrl.$setValidity('required', true); - ctrl.$setValidity('min', true); - ctrl.$setValidity('max', true); - ctrl.$dirty = true; - ctrl.$render(); - if (scope.job_template_form) { - // need a way to find the parent form and mark it dirty - scope.job_template_form.$dirty = true; - } - if (!scope.$$phase) { - scope.$digest(); + if (e.originalEvent && e.originalEvent.type === 'mousewheel') { + e.preventDefault(); + } else { + ctrl.$setViewValue(u.value); + ctrl.$setValidity('required', true); + ctrl.$setValidity('min', true); + ctrl.$setValidity('max', true); + ctrl.$dirty = true; + ctrl.$render(); + if (scope.job_template_form) { + // need a way to find the parent form and mark it dirty + scope.job_template_form.$dirty = true; + } + if (!scope.$$phase) { + scope.$digest(); + } } } };