Last year, I had an interesting conversation with my colleague Hans Hillen, who suggested using regular HTML heading elements within the data table's caption element. This technique is legal in HTML5, and ensures that not only is there an accessible name for the data table, but that screen reader users can also navigate using headings.
Author: Gez Lemon
In previous versions of HTML, it was invalid to have a heading element within the caption element. When a data table followed a regular heading, developers were reluctant to use the caption element because of the redundancy, yet using the caption element provides an accessible name for the table. Having an accessible name for the data table means that when a screen reader user navigates to a data table, they hear a title for the data table, rather than have to navigate through data cells to determine its purpose, or navigate to the previous heading element and hope that it's the correct heading for this data table.
As headings are now allowed in the caption element, providing the heading within the caption element ensures that not only can users benefit from heading navigation, the data tables also have an accessible name is announced when the user first navigates to the table. The name also appears in JAWS' table list using the keystroke: CONTROL + INSERT + T.