Grid
2 Grid variations from the W3C ARIA Authoring Practices Guide.
Grid (Data)
A sortable inventory combines data-grid navigation with native text and select editors. Hiding a column preserves its logical column indices and updates navigation; sorting reorders real table rows.
Example
Collection inventory
Use arrows to navigate. Enter or F2 edits a cell; Escape returns to navigation. Sort using the column buttons.
| Notes | Category | ||
|---|---|---|---|
| Bowl | 1920 | ||
| Camera | 1890 | ||
| Album | 1950 |
Keyboard interaction
Arrows, Home/End and Control+Home/End navigate cells. Enter/F2 enters an editor; native editing keys then remain available. Escape/F2 returns to grid navigation. Activate column-header buttons to sort.
Events
Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.
axxy-grid-edit— Dispatched when entering or exiting interactive cell edit mode. (target:Cell (td / [role="gridcell"]), detail:{ cell: HTMLElement, editing: boolean })
Example HTML
<axxy-scope>
<h3>Collection inventory</h3>
<p id="inventory-help">Use arrows to navigate. Enter or F2 edits a cell; Escape returns to navigation. Sort using the column buttons.</p>
<button type="button" id="hide-category" aria-pressed="false">Hide category</button>
<div style="max-height:24rem;overflow:auto">
<table role="grid" aria-label="Collection inventory" aria-describedby="inventory-help" aria-colcount="4">
<thead>
<tr>
<th scope="col" aria-colindex="1">
<button type="button">Object</button>
</th>
<th scope="col" aria-colindex="2">Notes</th>
<th scope="col" aria-colindex="3">Category</th>
<th scope="col" aria-colindex="4">
<button type="button">Year</button>
</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row" aria-colindex="1">Bowl</th>
<td aria-colindex="2">
<input aria-label="Bowl notes" value="Glazed clay">
</td>
<td aria-colindex="3">
<select aria-label="Bowl category">
<option selected>Ceramics</option>
<option >Photography</option>
<option >Print</option>
</select>
</td>
<td aria-colindex="4">1920</td>
</tr>
<tr>
<th scope="row" aria-colindex="1">Camera</th>
<td aria-colindex="2">
<input aria-label="Camera notes" value="Wood and brass">
</td>
<td aria-colindex="3">
<select aria-label="Camera category">
<option >Ceramics</option>
<option selected>Photography</option>
<option >Print</option>
</select>
</td>
<td aria-colindex="4">1890</td>
</tr>
<tr>
<th scope="row" aria-colindex="1">Album</th>
<td aria-colindex="2">
<input aria-label="Album notes" value="Paper and ink">
</td>
<td aria-colindex="3">
<select aria-label="Album category">
<option >Ceramics</option>
<option >Photography</option>
<option selected>Print</option>
</select>
</td>
<td aria-colindex="4">1950</td>
</tr>
</tbody>
</table>
</div>
</axxy-scope>Grid (Layout)
A layout grid groups each recipient link and remove button into a logical row. One tab stop represents the grid; horizontal movement wraps between rows. Native controls add and remove rows with status feedback.
Example
Message recipients
Arrow keys move among recipient links and remove buttons. Right and Left continue across logical rows.
Recipients receive the next museum newsletter.
Keyboard interaction
Arrows navigate; Left/Right continue across row boundaries. Home/End move within a row and Control+Home/End cover the whole grid. Enter follows a link or removes a recipient. The form adds a new row.
Events
Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.
axxy-grid-edit— Dispatched when entering or exiting interactive cell edit mode. (target:Cell (td / [role="gridcell"]), detail:{ cell: HTMLElement, editing: boolean })
Example HTML
<axxy-scope>
<h3 id="recipients-title">Message recipients</h3>
<p id="recipients-help">Arrow keys move among recipient links and remove buttons. Right and Left continue across logical rows.</p>
<div role="grid" aria-labelledby="recipients-title" aria-describedby="recipients-help" id="recipients-grid">
<div role="row" style="display:flex;gap:1rem;margin:.5rem 0">
<div role="gridcell">
<a href="#recipient-info">Alex</a>
</div>
<div role="gridcell">
<button type="button" data-remove-recipient aria-label="Remove Alex">Remove</button>
</div>
</div>
<div role="row" style="display:flex;gap:1rem;margin:.5rem 0">
<div role="gridcell">
<a href="#recipient-info">Jordan</a>
</div>
<div role="gridcell">
<button type="button" data-remove-recipient aria-label="Remove Jordan">Remove</button>
</div>
</div>
<div role="row" style="display:flex;gap:1rem;margin:.5rem 0">
<div role="gridcell">
<a href="#recipient-info">Sam</a>
</div>
<div role="gridcell">
<button type="button" data-remove-recipient aria-label="Remove Sam">Remove</button>
</div>
</div>
</div>
<form id="recipient-form">
<label for="recipient-name">New recipient name</label>
<input id="recipient-name" required>
<button>Add recipient</button>
</form>
<p role="status" id="recipient-status"></p>
<p id="recipient-info">Recipients receive the next museum newsletter.</p>
</axxy-scope>