The alert role is causing problems for screen readers: either the error message is announced instead of the label for the form field or the label is announced by not the error message. The example code (as shown with the inline validation states) connects the error message to the form field with aria-describedby. Removing the alert role allows the ARIA description to work properly.
Note: An alert role would be appropriate for a page level alert.
Inline error messages have
role="alert"
.https://rivet.iu.edu/components/overlays/alerts/#standalone-inline-alerts https://rivet.iu.edu/components/forms/text-input/#inline-validation-states
The alert role is causing problems for screen readers: either the error message is announced instead of the label for the form field or the label is announced by not the error message. The example code (as shown with the inline validation states) connects the error message to the form field with aria-describedby. Removing the alert role allows the ARIA description to work properly.
Note: An alert role would be appropriate for a page level alert.