Ensure table columns, rows, and cells have proper ARIA labels
To display content in a table, table elements need to be properly labeled to be understood by people who use assistive technologies. While there’s currently no way in Webflow to natively create an HTML <table> element, you can create an equivalent structure using a series of <div> elements and proper aria attributes.
An element with role=”table” is a static tabular structure with rows containing cells. The cells are not focusable or selectable, but widgets within individual table cells can be interactive. Using a native HTML table element whenever possible is strongly encouraged.
Adding ARIA attributes:
To create an accessible table, semantic table elements, such as <tbody>, <thead>, <tr>, <th>, and <tbody> need to be referenced via associated roles, such as ”table”, ”row”, ”columnheader”, and ”cell”.
- Add <checks-richtext_code>role=”table”<checks-richtext_code> to the container element
- Add <checks-richtext_code>role=”row”<checks-richtext_code> to all the rows
- Add <checks-richtext_code>role=”cell”<checks-richtext_code> to every cell
- Add <checks-richtext_code>role=”columnheader”<checks-richtext_code> to all the column headers
- Add <checks-richtext_code>role=”rowheader”<checks-richtext_code> to all row headers
- Add <checks-richtext_code>aria-rowcount=”number-of-rows”<checks-richtext_code> to the container element (where “number-of-rows” is the actual number of rows in the table)
- The table caption can be defined via <checks-richtext_code>aria-labelledby<checks-richtext_code> or <checks-richtext_code>aria-label<checks-richtext_code>
Below is an example of proper HTML structure and labeling: