Provide a data grid with a labelled dataset, visible column and row identity, one managed entry point in page tab order, arrow-key cell navigation, explicit edit mode, stable selection, truthful row and column metadata, and recovery for sorting, filtering, virtualization, validation, and saving.
Users repeatedly inspect or update many records in shared columns.
Cells, rows, or ranges are interactive and benefit from arrow-key navigation rather than hundreds of tab stops.
The workflow includes editing, selection, copy and paste, column operations, virtualized records, or spreadsheet-like shortcuts.
The team can implement and maintain a tested keyboard and accessibility model.
Avoid when
The data is read-only and ordinary table navigation is enough.
Only one value needs occasional in-place editing.
Rows are better understood as cards, messages, feed items, or object summaries.
The content is a form with unrelated labels and dependencies.
The available viewport or platform cannot support dense cell navigation accurately.
Problem it prevents
Users need to inspect, select, edit, sort, filter, copy, or operate on many records in rows and columns, but a basic table becomes slow or unsafe when every cell, widget, and row action is placed in normal tab order or when editing has no grid focus contract.
Pattern anatomy
What a strong implementation has to make clear
User need
The task involves many records with shared columns, and users repeatedly move across cells or down columns to compare, update, or triage values.
Pattern promise
Provide a data grid with a labelled dataset, visible column and row identity, one managed entry point in page tab order, arrow-key cell navigation, explicit edit mode, stable selection, truthful row and column metadata, and recovery for sorting, filtering, virtualization, validation, and saving.
Required state
Default navigation state with labelled grid, column headers, row headers or row identifiers, focused cell, and row count context.
Recovery path
Keyboard users tab through every cell and cannot efficiently reach controls after the grid.
Access contract
Use grid semantics only for an interactive composite widget with managed focus.
Quality bar
The difference between expert and weak execution
Strong implementation
Specific, visible, recoverable
An invoice-review grid shows frozen invoice IDs, column headers for Vendor, Amount, Due, Owner, and Status, one highlighted focused cell, two selected rows, a dirty edited amount, and a status line naming the current cell.
A virtualized asset grid shows row 41 of 2,000, col 5 of 12, a selected range, and a toolbar with Sort, Filter, Columns, Copy, and Save changes commands.
A user presses Arrow Right to move from Amount to Due, presses Enter to edit the due date, presses Escape to cancel, and focus returns to the same cell in navigation mode.
A user pastes three invalid amounts, sees each invalid cell marked with a message, fixes them in place, saves, and the grid keeps selection and scroll position after the server responds.
Weak implementation
Vague, hidden, hard to recover from
A static report uses role grid even though users only read values and ordinary table semantics would be clearer.
Every cell is an input or menu in page tab order, so reaching the Save button requires tabbing through hundreds of controls.
A user edits an amount, sorts by status, and the row disappears with no saved or unsaved indication.
A keyboard user opens a cell menu and cannot return to the same grid cell or leave the grid without reloading the page.
UI guidance
Render the grid as a named work surface with visible headers, row identifiers, focus location, selection state, dirty and invalid cell markers, column controls, and status text for row count, sort, filter, and save state.
Keep visual density deliberate: align values for scanability, separate focus from selection, expose readonly and editable cells, and provide a compact but reachable toolbar for grid-level actions.
UX guidance
Use a data grid when cell-level interaction makes users faster and more accurate than opening each record separately.
Treat focus, edit mode, selection, validation, save, sort, filter, virtual scroll, and pagination as one workflow contract instead of isolated features.
Implementation contract
What the implementation must handle
States
Default navigation state with labelled grid, column headers, row headers or row identifiers, focused cell, and row count context.
Focused-cell state that distinguishes focus from selection and survives movement across rows and columns.
Selected row, selected cell, selected range, and bulk-selected states when selection is supported.
Edit mode for a cell or row, with clear entry, focused editor, dirty draft, save, cancel, and validation states.
Interaction
Tab moves into the grid at one managed focus point and out to the next page control rather than visiting every cell by default.
Arrow keys move focus between cells; Home, End, Page Up, Page Down, and modified Home or End commands move by row, viewport, or grid boundary according to the documented contract.
The focused cell, selected cell, selected row, checked row, active editor, hover target, and row action are visually and programmatically distinct.
Column headers that sort, filter, resize, pin, or open menus are reachable and announce their current state.
Accessibility
Use grid semantics only for an interactive composite widget with managed focus.
Give the grid a programmatic label and optional description for keyboard help and current state.
Expose column headers, row headers or row identifiers, rows, and grid cells through native or ARIA semantics.
Keep one managed cell or inner widget in the page tab sequence unless a deliberate edit mode changes the contract.
Review
What does one row represent, and what is the primary row identifier?
Which cells are navigable, editable, readonly, selected, invalid, dirty, or saving?
Can a keyboard user enter the grid, move by cell, edit, cancel, save, select, copy, and leave without getting trapped?
When does focus land on the cell itself versus an element inside the cell?
Interactive lab
Inspect the states before you copy the pattern
Navigate an editable data grid
Move the focused cell with arrow controls, enter edit mode, type and save a value, select rows, page virtual rows, validate bad paste, leave the grid, and compare static-role, tab-every-cell, arrow-conflict, wrong-index, lost-focus, and mobile-trap failures.
Data grid
Interactive demo is ready
Launch the live UI/UX lab when you want to inspect states, keyboard behavior, and common failure modes.
State To Inspect
Default navigation state with labelled grid, column headers, row headers or row identifiers, focused cell, and row count context.
Keyboard / Access
Tab moves focus into the grid at the current cell or first useful cell, and a subsequent Tab leaves the grid or follows the documented inner-widget contract.
Avoid Generating
Using role grid on a static table only to make it sound richer.
APG grid guidance supports the core data-grid interaction model, keyboard navigation, editing boundary, selection, focus management, and ARIA roles and states.
AG Grid accessibility guidance supports production concerns around ARIA metadata, virtualization, DOM order, screen reader testing, and grid limitations.
MUI data-grid accessibility guidance supports one tab stop, inner-cell focus management, navigation, selection, copying, and sorting shortcuts.
Full agent/debug reference
Problem Context
The task involves many records with shared columns, and users repeatedly move across cells or down columns to compare, update, or triage values.
Cells may contain editable values, links, menus, checkboxes, validation, calculated values, row actions, or status widgets.
Users need keyboard-efficient navigation that avoids hundreds of tab stops while keeping cell identity and row context clear.
The product may virtualize rows or columns, hide columns, sort, filter, pin, paginate, copy, paste, or save individual cell changes.
Selection Rules
Choose data grid when row-and-column data is interactive enough to require managed cell focus, arrow-key movement, selection, editing, or keyboard shortcuts.
Use a table when records are mainly read-only comparison and ordinary links, buttons, or checkboxes in row order are sufficient.
Use inline edit when one displayed value or one row enters local edit mode without full spreadsheet-style navigation.
Use tree grid instead of data grid when rows are hierarchical and expandable while still needing columns.
Use list view, card list, or card grid when object summaries, imagery, or uneven metadata matter more than column-by-column work.
Use transfer list when the task is moving items between sets rather than editing cells in place.
Use pagination, infinite loading, or saved views to control very large row counts, but do not let paging erase grid focus, selection, or edit state.
Avoid data grid when the task is a form with unrelated fields, section dependencies, or review-before-submit consequences.
Avoid data grid when the team cannot implement and test keyboard navigation, focus movement, edit mode, row and column metadata, and screen reader behavior.
Avoid forcing a dense data grid onto mobile when a list-plus-detail or focused edit route would preserve task accuracy better.
Required States
Default navigation state with labelled grid, column headers, row headers or row identifiers, focused cell, and row count context.
Focused-cell state that distinguishes focus from selection and survives movement across rows and columns.
Selected row, selected cell, selected range, and bulk-selected states when selection is supported.
Edit mode for a cell or row, with clear entry, focused editor, dirty draft, save, cancel, and validation states.
Readonly or locked-cell state for cells that can be navigated but not changed.
Sorted, filtered, grouped, hidden-column, and resized-column states with visible and programmatic state feedback.
Virtualized, paginated, or lazy-loaded state with truthful total row and column counts, visible indices, and loading boundaries.
Copied, pasted, invalid paste, undo, redo, saving, saved, failed-save, and conflict states when grid editing supports those actions.
Empty, no-results, permission-restricted, and partial-data states that keep the grid label and recovery path visible.
Narrow-screen or reduced-column state that preserves row identity, edit safety, and a route to the full task.
Interaction Contract
Tab moves into the grid at one managed focus point and out to the next page control rather than visiting every cell by default.
Arrow keys move focus between cells; Home, End, Page Up, Page Down, and modified Home or End commands move by row, viewport, or grid boundary according to the documented contract.
The focused cell, selected cell, selected row, checked row, active editor, hover target, and row action are visually and programmatically distinct.
Column headers that sort, filter, resize, pin, or open menus are reachable and announce their current state.
Entering edit mode with Enter, F2, typing, or an explicit Edit command moves focus into the editor and temporarily changes how arrow keys are interpreted.
Escape cancels editing or returns to grid navigation according to a visible and tested discard contract.
Saving a cell, row, or pasted range keeps the edited location understandable after sorting, filtering, pagination, refresh, or server validation.
Virtualization, hidden columns, frozen areas, and pinned rows must not make row or column indices, reading order, or focused-cell restoration untrue.
Implementation Checklist
Define the grid purpose, row object, primary row identifier, columns, editable fields, readonly fields, selection model, and supported shortcut set.
Choose native table plus role grid or ARIA row and gridcell structure only when the interaction truly behaves as a grid.
Expose a label or labelled heading for the grid and a description for keyboard help, row count, filters, or selection status.
Use row, columnheader, rowheader, and gridcell semantics, and provide aria-rowcount, aria-colcount, aria-rowindex, and aria-colindex when rows or columns are virtualized or hidden.
Keep only the current managed cell or inner widget in the page tab sequence and update tabIndex as focus moves.
Separate navigation mode from edit mode, including how Enter, F2, typing, Escape, Tab, arrow keys, and Save behave.
Associate validation messages, dirty indicators, readonly state, and save errors with the affected cell or row.
Preserve focused cell, selected rows, expanded detail, dirty edits, and scroll position across sort, filter, pagination, refresh, and column visibility changes where possible.
Test with keyboard only, screen readers, high contrast, zoom, row virtualization, long values, pasted invalid data, mobile viewports, and assistive-technology reading order.
Common Generated-UI Mistakes
Using role grid on a static table only to make it sound richer.
Putting hundreds of inputs, menus, and links into normal tab order instead of implementing managed focus.
Calling a dense settings form a data grid even though fields do not share row and column meaning.
Letting arrow keys both navigate cells and operate the active cell editor without an edit-mode boundary.
Hiding columns or virtualizing rows without row and column counts, indices, or truthful reading order.
Using color alone for selected, dirty, invalid, readonly, and saved cell states.
Sorting or filtering while a cell is dirty and moving it out of view before users can confirm the result.
Packing row actions, nested menus, multiselect widgets, and expandable detail into cells without a tested focus strategy.
Critique Questions
What does one row represent, and what is the primary row identifier?
Which cells are navigable, editable, readonly, selected, invalid, dirty, or saving?
Can a keyboard user enter the grid, move by cell, edit, cancel, save, select, copy, and leave without getting trapped?
When does focus land on the cell itself versus an element inside the cell?
What happens to focus, selection, dirty edits, and validation after sort, filter, pagination, virtual scroll, refresh, or save failure?
Would a table, inline edit, list view, card layout, transfer list, or complex form solve the task with less interaction cost?
Accessibility
Use grid semantics only for an interactive composite widget with managed focus.
Give the grid a programmatic label and optional description for keyboard help and current state.
Expose column headers, row headers or row identifiers, rows, and grid cells through native or ARIA semantics.
Keep one managed cell or inner widget in the page tab sequence unless a deliberate edit mode changes the contract.
Expose aria-selected for selected cells or rows, aria-readonly for navigable locked values, and aria-sort for sortable headers.
Use aria-rowcount, aria-colcount, aria-rowindex, and aria-colindex when rows or columns are hidden, loaded lazily, virtualized, or not all present in the DOM.
Do not rely on visual position, color, frozen panes, or hover affordances alone to communicate cell identity, selection, errors, or editability.
Test screen reader announcements for focused cell, header association, selected state, invalid edit, sorted column, and virtualized row position.
Keyboard Behavior
Tab moves focus into the grid at the current cell or first useful cell, and a subsequent Tab leaves the grid or follows the documented inner-widget contract.
Arrow keys move focus by cell in navigation mode without wrapping in ways that contradict row and column meaning.
Home and End move to the first or last cell in the current row; modified Home and End can move to the first or last cell in the whole grid.
Page Up and Page Down move by a visible row group or page when the grid scrolls or virtualizes rows.
Enter, F2, typing, or an explicit Edit command enters edit mode when the focused cell is editable.
Escape cancels an edit or restores grid navigation, with dirty changes handled explicitly.
Space, Shift+Space, modified Space, Shift+Arrow, or product-specific shortcuts select rows, columns, or ranges only when selection is supported and documented.
Column headers support keyboard sorting, menus, resizing, or pinning only when those functions are visible and labelled.