ARIA property
aria-colcount
How many columns a table really has, when only some are rendered.
It tells a screen reader the width of the real table rather than the width of the slice you rendered. Announcements along the lines of column 3 of 40 come from this. Without it the count is whatever happens to be in the DOM, which in a virtualised grid is a number that means nothing.
Which roles may carry aria-colcount
- Value
- integer
- Filed as
- A property, which is how ARIA files it and not a rule about how often it changes.
- Roles that may carry it
table
Those lists are not advice. Browsers are required to ignore a non-global attribute sitting on a role that does not support it, so aria-colcount on the wrong element is not weak, it is absent. You can read it in the DOM and nobody using a screen reader can.
Every role above comes from the specification's own list for this attribute, checked name for name. The normative definition stays with the W3C, in the aria-colcount section of the ARIA specification.
Keeping aria-colcount true
The value has to track the real table, so anything that adds, removes or hides a column has to write it again. Where you genuinely cannot know the total, the spec gives you -1 to say exactly that, and asks you to use it rather than guess. A guessed number is worse than no number at all, because it is the one people will hear and believe. The other half of the job is aria-colindex on the cells, since a total with no positions attached does not place anybody.
How aria-colcount gets checked
There are test rules that check an ARIA attribute is one that exists, is allowed on the role underneath it, and carries a value of the right type. What they map to is ARIA's own author requirements rather than any WCAG criterion, so a misplaced attribute breaks ARIA without being a WCAG failure by itself. It becomes one under 4.1.2 Name, Role, Value the moment the missing or wrong value means the control's state cannot be worked out programmatically, which is what usually happens next.
Nothing automated catches the failure this page is about. A stale value is a valid value, on a permitted role, with the right type. It is only wrong about the world.
Attributes you will meet alongside aria-colcount
- aria-rowcount How many rows the table really has, when only some are rendered.
Every ARIA state and property · Every ARIA role · ARIA explained