diff --git a/core/includes/form.inc b/core/includes/form.inc
index a789322..d63596e 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -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';
   }
 }
 
diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php
index f402395..fecc0b8 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormTest.php
@@ -248,6 +248,9 @@ function testRequiredTextfieldNoTitle() {
     // 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(
