third_party/aria-practices/src/content/patterns/grid/examples/data-grids.html
Following are three example implementations of the Grid Pattern that demonstrate the keyboard interactions and ARIA features that enable accessible, interactive presentation of tabular information. Each of the following three grids presents a set of financial transactions. The first is a simple grid with minimum ARIA markup and keyboard support. The second and third implementations add advanced features, such as content editing, sort, scroll, and show/hide.
Similar examples include:
| Date | Type | Description | Amount | Balance |
|---|---|---|---|---|
| 01-Jan-16 | Deposit | Cash Deposit | $1,000,000.00 | $1,000,000.00 |
| 02-Jan-16 | Debit | Down Town Grocery | $250.00 | $999,750.00 |
| 03-Jan-16 | Debit | Hot Coffee | $9.00 | $999,741.00 |
| 04-Jan-16 | Debit | The Filling Station | $88.00 | $999,653.00 |
| 05-Jan-16 | Debit | Tinker's Hardware | $3,421.00 | $996,232.00 |
| 06-Jan-16 | Debit | Cutey's Salon | $700.00 | $995,532.00 |
| Date | Type | Description | Category | Amount | Balance |
|---|---|---|---|---|---|
| 01-Jan-16 | Deposit | ||||
| Cash Deposit | |||||
| Income |
| $1,000,000.00 | $1,000,000.00 | | 02-Jan-16 | Debit | Down Town Grocery | Groceries
| $250.00 | $999,750.00 | | 03-Jan-16 | Debit | Hot Coffee | Dining Out
| $9.00 | $999,741.00 | | 04-Jan-16 | Debit | The Filling Station | Auto
| $88.00 | $999,653.00 | | 05-Jan-16 | Debit | Tinker's Hardware | Household
| $3,421.00 | $996,232.00 | | 06-Jan-16 | Debit | Cutey's Salon | Beauty
| $700.00 | $995,532.00 | | 07-Jan-16 | Debit | My Chocolate Shop | Dining Out
| $41.00 | $995,491.00 |
Hide Type and Category
| Date | Type | Description | Category | Amount | Balance |
|---|---|---|---|---|---|
| 01-Jan-16 | Deposit | Cash Deposit | Income | $1,000,000.00 | $1,000,000.00 |
| 02-Jan-16 | Debit | Down Town Grocery | Groceries | $250.00 | $999,750.00 |
| 03-Jan-16 | Debit | Hot Coffee | Dining Out | $9.00 | $999,741.00 |
| 04-Jan-16 | Debit | The Filling Station | Auto | $88.00 | $999,653.00 |
| 05-Jan-16 | Debit | Tinker's Hardware | Household | $3,421.00 | $996,232.00 |
| 06-Jan-16 | Debit | Cutey's Salon | Beauty | $700.00 | $995,532.00 |
| 07-Jan-16 | Debit | My Chocolate Shop | Dining Out | $41.00 | $995,491.00 |
| 08-Jan-16 | Debit | Who's Cook'n | Dining Out | $150.00 | $995,341.00 |
| 09-Jan-16 | Debit | Dmuddy Paws | Pet | $100.00 | $995,241.00 |
| 10-Jan-16 | Debit | West End Bikes | Recreation | $6,420.00 | $988,821.00 |
| 11-Jan-16 | Debit | Pay More Cars | Auto | $431,323.00 | $557,498.00 |
| 12-Jan-16 | Debit | The Interior Shop | Household | $142,334.00 | $415,164.00 |
| 13-Jan-16 | Debit | Adventure Guys | Recreation | $88,424.00 | $326,740.00 |
| 14-Jan-16 | Debit | Hungry Folks Place | Dining Out | $313.00 | $326,427.00 |
| 15-Jan-16 | Debit | Horse Play | Recreation | $2,421.00 | $324,006.00 |
aria-rowindex value of the row containing the focus informs the screen reader of the number of that row within the total set of rows.aria-colindex value on a cell informs screen readers of the position of that cell within the row. When one or more columns are hidden, screen reader users can be aware of the hidden columns because those column numbers are not present as users navigate across a row.| key | Function |
|---|---|
| Right Arrow |
| | Left Arrow |
| | Down Arrow |
| | Up Arrow |
| | Page Down |
| | Page Up |
| | Home | moves focus to the first cell in the row that contains focus. | | End | moves focus to the last cell in the row that contains focus. | | Control + Home | moves focus to the first cell in the first row. | | Control + End | moves focus to the last cell in the last row. |
| Role | Attribute | Element | Usage |
|---|---|---|---|
grid | table |
grid role is applied to a table element, the row , rowheader, colheader, and gridcell roles do not need to be specified because they are implied by tr, th, and td tags.|
| | aria-labelledby="ID_REF" | table | Refers to the heading element that labels the grid. |
| | aria-rowcount="16" | table |
display:none, which excludes them from the browser's accessibility tree.aria-rowcount is when not all data is loaded into the DOM at one time.|
| | aria-colcount="6" | table |
aria-rowcount overrides the browser calculation of the total number of rows, the browser uses this value for the total number of columns so it can report the correct number when columns are hidden.|
| | aria-rowindex="INDEX_VALUE" | tr |
|
| | aria-sort="ascending" | th | In example 2, applied when a column is sorted in ascending order. |
| | aria-sort="descending" | th | In example 2, applied when a column is sorted in descending order. |
| | aria-sort="none" | th | In example 2, applied when a column is sortable but not sorted. |
| | aria-colindex="INDEX_VALUE" | th and td |
|
CSS:
JavaScript:
To copy the following HTML code, please open it in CodePen.
To copy the following HTML code, please open it in CodePen.
To copy the following HTML code, please open it in CodePen.