Potential A11y Violation:
Invalid caption elements in layout tables
Point of Failure
Tables should not be used for layout at all. Many modern solutions exist, such as flexbox or grid in CSS. However, there are cases where legacy code may need to be maintained but not updated; it still must meet accessibility criteria. In these cases, the <caption>
element should not be used in layout tables (tables marked with role="presentation"
or role="none"
).
Available Automation Evaluation
In checking known available linting and testing tools, these are our findings.
Linting Could Exist
It's possible that a linting rule could be created for this potential failure. Look for table elements with the role of presentation or none, and ensure that they do not contain the caption element.
Testing Could Exist
It's possible that a check could be created for this potential failure. Look for table elements with the role of presentation or none, and ensure that they do not contain the caption element.
Other Test Methods
In addition to automated tests, there are other types of tests that could be conducted to prevent this potential violation.
Developer Authored Test Could Exist
Developers should make sure that their code does not violate this rule, and try to write a test that would prevent a regression in accessibility if the code is later changed.
Manual Test Must Exist
Review page and ensure the point of failure does not exist, inspecting the DOM where required.