Issue #2047075 by Caecus, mgifford, jessebeach, larowlan: Mark invalid form field with [aria-invalid=true].

8.0.x
webchick 2013-08-10 01:46:10 -07:00
parent aac3160d50
commit 5e30494edb
2 changed files with 4 additions and 0 deletions

View File

@ -4842,6 +4842,7 @@ function _form_set_attributes(&$element, $class = array()) {
}
if (isset($element['#parents']) && form_get_error($element) !== NULL && !empty($element['#validated'])) {
$element['#attributes']['class'][] = 'error';
$element['#attributes']['aria-invalid'] = 'true';
}
}

View File

@ -248,6 +248,9 @@ class FormTest extends WebTestBase {
// Check the page for the error class on the textfield.
$this->assertFieldByXPath('//input[contains(@class, "error")]', FALSE, 'Error input form element class found.');
// Check the page for the aria-invalid attribute on the textfield.
$this->assertFieldByXPath('//input[contains(@aria-invalid, "true")]', FALSE, 'Aria invalid attribute found.');
// Submit again with required fields set and verify that there are no
// error messages.
$edit = array(