liveBook · Manning

Grid role

As explained in Architecting Accessibility

The grid role is an ARIA role that identifies a widget as a grid with spreadsheet-like interaction expectations.

When people need to move through tabular data like a spreadsheet, `role="grid"` tells assistive technology to expect a two-dimensional keyboard interaction model. It is a promise, not an implementation: keyboard behavior and focus management still need to be built, tested, and maintained. section 6.2.2 section 6.2

Choose a grid when users need to navigate between cells with keys such as the arrows, Home, or End, and possibly select or edit cells. For data people mainly read or review, use a table instead. Links, buttons, sorting, or filtering alone do not require a grid. section 6.2

<table id="orders-grid" 
  role="grid" #A
  aria-multiselectable="true" #B
  aria-labelledby="orders-heading" #C
  aria-describedby="orders-help"> #D
  <thead>
    <tr>
      <th scope="col">Order</th>
      <th scope="col">Customer</th>
      <th scope="col">Date</th>
      <th scope="col">Status</th>
      <th scope="col">Amount</th>
      <th scope="col">Delivery address</th>
    </tr>
  </thead>
  <tbody>
    <tr>
    ...

This example adds `role="grid"` to a native table. Native table elements provide structure; when using other elements, add the ARIA roles needed to express rows, headers, and cells. section 6.2.2

A grid also needs predictable keyboard access and clear relationships between headers and cells. For virtualized data, expose the full row and column counts and the positions of rendered rows and cells. section 6.2.2 section 6.2

How Architecting Accessibility covers it

How deep it goes
Explains semantic markup and implementation obligations, while leaving keyboard behavior to be implemented and maintained.
Examples
Uses a native table marked as a grid and describes arrow-key navigation, cell selection, and editing.
What it assumes
Assumes familiarity with tabular data and HTML elements such as tables, rows, headers, and cells.
What you can do after
Evaluate whether tabular data needs spreadsheet-style navigation before choosing a grid over a table.
How it connects
Connects grids with HTML tables, ARIA row and cell roles, keyboard navigation, focus management, and virtualization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Architecting Accessibility. The section links point to the parts of the book it draws on.