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:
Nick Schonning
2013-06-24 12:34:39 -04:00
committed by Jörn Zaefferer
parent 1a0bfe32b1
commit 600e292463

View File

@@ -379,6 +379,9 @@ $.extend($.validator, {
} else {
this.invalid[element.name] = true;
}
//Add aria-invalid status for screen readers
$(element).attr("aria-invalid", !result);
if ( !this.numberOfInvalids() ) {
// Hide error containers on last error
this.toHide = this.toHide.add( this.containers );