Skip to content

Unnecessary aria-describedby attribute causes WCAG scans to fail #2094

Open
@ssalyers

Description

@ssalyers

Subject of the issue

Valid form elements get aria-describedby added to them when they shouldn't

Your environment

  • 1.17.0
  • Chrome 61.0.3163.100 & Firefox 56.0.1

Steps to reproduce

1 - Create a form with at least 2 fields with validation on them
2 - Inspect the form fields and verify that they do not have aria-describedby attributes
3 - Submit the form with at least one field value that passes validation and at least one that does not, so the form doesn't actually post
4 - Inspect the valid form field

Expected behaviour

Nothing pointing to an error ought to change or be added to the field, since it's valid

Actual behaviour

The valid form field has had the aria-describedby attribute added, though the fieldname-error HTML element it references doesn't exist, since no error message was necessary. A WCAG/ADA scanner run at that point (for example, the aXe Chrome plugin) will flag the valid field as having a problem because the aria-describedby value is invalid

I corrected this locally by adding a check if message is null in the showLabel method before adding that attribute. That doesn't seem to have hurt anything, but counting on the absence of a message doesn't seem great. Some way to check if the element is valid before adding the new attribute would be great.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions