HTML: RSPEC-1085 requires that every data table has a description

Based on RSPEC-1085, SonarLint requires that each table has a description, which may be provided as a caption element, referenced by means of aria-describedby or provided as an aria-label attribute. (I am ignoring the old summary attribute, which is deprecated in HTML 5.)

The claim that every data table requires a description appears to be based on a misunderstanding. What WCAG success criterion 1.3.1 requires with regard to table captions is the following:
if a table has text above it that looks like the table’s caption, then it must be marked up with a caption element (which is actually a child element of table). If for some reason, the caption element cannot be used, the “caption” can be referenced by means of aria-describedby.

Note the “if”. There is no requirement for a caption on every table, even though this is a good practice.

The inclusion of aria-label, which is for non-visible label and therefore unfit for table captions, confirms the impression that the rule is based on a misunderstanding.

For the sake of completeness, the error or warning is triggered by code such as the following:


(Even though I am using SonarLint, I assume this issue also applies to other Sonar products that implement this rule. It was reported to me as an issue flagged by SonarQube.)