diff --git a/src/index.ts b/src/index.ts index d79c30f..23b927a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1234,8 +1234,8 @@ export class ValidationService { */ createValidator(input: ValidatableElement, directives: ValidationDirective) { return async () => { - // only validate visible fields - if (!this.isHidden(input)) { + // only validate visible and enabled fields + if (!this.isHidden(input) && !this.isDisabled(input)) { for (let key in directives) { let directive = directives[key]; let provider = this.providers[key]; @@ -1286,6 +1286,15 @@ export class ValidationService { return !(this.allowHiddenFields || input.offsetWidth || input.offsetHeight || input.getClientRects().length); } + /** + * Checks if the provided input is disabled + * @param input + * @returns + */ + private isDisabled(input: HTMLElement) { + return input.getAttribute('disabled') !== null; + } + /** * Adds addClass and removes removeClass * @param element Element to modify