Michael Gaigg: Über UI/UX Design

1Aug0

Highlights of Week 30/2011

Posted by Michael Gaigg

20Nov0

Best Practices for accessible Tables

Posted by Michael Gaigg

The purpose of a table is to layout data. Unlike regular text, tables are generally difficult to comprehend. It takes time and effort to understand the structure, capture the data and interpret its meaning. This is even more difficult when the table is viewed and read out by a screenreader. Additional attributes are needed to relate headers with column and rows.

Tables might be used to layout content. The current recommendation for content tables is to explicitely state this purpose upfront so that users with screenreaders can avoid investigating the table's structure. Convey this meaning using the summary attribute:

<table border="0" summary="Layout table with two columns: menu and content">

Basic Rules

General:

  • Use proper HTML
  • Use tables for displaying tabular data
  • Use block elements (e.g. DIV) and CSS for layout purposes
  • Use proportional sizing rather than absolute sizing

Data Tables:

  • Describe tables with a name or title (caption tag)
  • Provide a summary (summary attribute)
  • Designate Row and Column Headers (TH tag)
  • Associate the data cells with the appropriate headers (scope & id attributes)
  • Avoid spanned rows or columns (workaround: normalize table)
  • Avoid tables with more than two levels of row and/or column headers

Layout Tables:

  • Linearize content (literal order in the code equals the linearized reading order)
  • Use the simplest table configuration possible

Best Practices

Level 1

Level 1 Checkpoints - Section 508 Compliancy Standards
Description W3C 508 Example
For data tables, identify row and column headers 5.1 (g) <TR>
<TH>Name</TH>
<TH>Cups</TH>
<TH abbr="Type">Type of Coffee</TH>
<TH>Sugar?</TH>
</TR>
For data tables that have two or more logical levels of row or column headers, use markup to associate data cells and header cells 5.2 (h) <TABLE border="1">
  <CAPTION>Travel Expense Report</CAPTION>
  <TR>
    <TH></TH>
    <TH id="header2" axis="expenses">Meals
    <TH id="header3" axis="expenses">Hotels
    <TH id="header4" axis="expenses">Transport
    <TD>subtotals</TD>
  <TR>
    <TH id="header6" axis="location">San Jose
    <TH> <TH> <TH> <TD>
  <TR>
    <TD id="header7" axis="date">25-Aug-97
    <TD headers="header6 header7 header2">37.74
    <TD headers="header6 header7 header3">112.00
    <TD headers="header6 header7 header4">45.00
    <TD>
  <TR>
    <TD id="header8" axis="date">26-Aug-97
    <TD headers="header6 header8 header2">27.28
    <TD headers="header6 header8 header3">112.00
    <TD headers="header6 header8 header4">45.00
    <TD>
  <TR>
    <TD>subtotals
    <TD>65.02
    <TD>224.00
    <TD>90.00
    <TD>379.02
</TABLE>

Level 2

No Level 2 requirements.

Level 3

Level 3 Checkpoints - Section 508 Compliancy Standards
Description W3C 508 Example
Provide summaries for tables 5.5 n/a <TABLE summary="This table charts the number of cups of coffee ...">
Provide abbreviations for header labels 5.6 n/a <TABLE ...>
<TH scope="col">Name</TH>
<TH scope="col">Cups</TH>
<TH scope="col" abbr="Type">Type of Coffee</TH>
<TH scope="col">Sugar?</TH>
</TABLE>
Provide a linear text alternative (on the current page or some other) for all tables that lay out text in parallel, word-wrapped columns 10.3 n/a n/a

References