Merge pull request #4930 from mabashian/4889-number-input-scroll

Prevent usage of mousewheel on spinner elements

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-10-08 14:25:07 +00:00 committed by GitHub
commit 52b145dbf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();
}
}
}
};