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?
I have no explicit explanation for the problem but since Visual Studio creates shadow copies in the background I could solve the issue by clearing the cashe and deleting all shadow files for the project and a rebuild afterwards.