I am using the latest version of jQuery Validation Unobtrusive in combination with the latest version of jQuery Validate. The validation itself works like a charm. However if the field is invalid, values will be added to the aria-describedby
attribute.
Let's say I want to type in my password (for validation the length of the password must be greater than 6). The initial HTML looks like this:
<input data-val="true" data-val-minlength="The field Passwort must be a string or array type with a minimum length of '6'."
data-val-minlength-min="6" data-val-required="The Passwort field is required."
id="Password" name="Password" tabindex="2"
type="password">
I start to type a password with only 5 characters and then remove focus from the input
by clicking somewhere on the body
. The validation runs through and a bunch of attributes and values including aria-describedby
will be added. Now the aria-describedby
attribute only has a single value Password-error
. If I then focus the input field again and remove all characters and even keep pressing backspace, a new value on each keyup is added. This results in the following:
<input data-val="true"
data-val-minlength="The field Passwort must be a string or array type with a minimum length of '6'."
data-val-minlength-min="6"
data-val-required="The Passwort field is required."
id="Password" name="Password" tabindex="2" type="password" aria-required="true"
aria-invalid="true" class="input-validation-error"
aria-describedby="Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error Password-error
Password-error">
This is quite an overhead of values for the attribute considiering that the values are equal. Is this behaviour usual or does someone know how to fix this?
This issue was present in v1.13.0 of jquery.validate.js but has since been fixed (in at least v1.14.0).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With