mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-20 09:11:40 +01:00
Set aria-invalid attribute based on validation
As per http://www.w3.org/TR/wai-aria/states_and_properties#aria-invalid the validation states should only be added after a user has had a chance to enter a value
This commit is contained in:
committed by
Jörn Zaefferer
parent
1a0bfe32b1
commit
600e292463
@@ -379,6 +379,9 @@ $.extend($.validator, {
|
|||||||
} else {
|
} else {
|
||||||
this.invalid[element.name] = true;
|
this.invalid[element.name] = true;
|
||||||
}
|
}
|
||||||
|
//Add aria-invalid status for screen readers
|
||||||
|
$(element).attr("aria-invalid", !result);
|
||||||
|
|
||||||
if ( !this.numberOfInvalids() ) {
|
if ( !this.numberOfInvalids() ) {
|
||||||
// Hide error containers on last error
|
// Hide error containers on last error
|
||||||
this.toHide = this.toHide.add( this.containers );
|
this.toHide = this.toHide.add( this.containers );
|
||||||
|
|||||||
Reference in New Issue
Block a user