WarUI

Focus restoration after re-render and data updates

GRID-A11-F22P0baselinePlanned

Keeps keyboard focus on the same logical cell, identified by row key and column id, after re-renders caused by data updates, sorting, column reordering or live streaming changes. When the target disappears, a documented fallback picks the nearest sensible cell. Losing focus to the document body is a common accessibility failure, and this feature prevents it.

Planned. This page shows the specification from issue #189. The live example, source for every framework and the API reference replace it when the feature ships.

Live example

A live stock grid that updates every second with random re-sorting, with focus on a cell.

Expected behavior

With byKey, the focus follows the row and column through sorting and updates. When the focused row is deleted, the focus moves according to the fallback. With 'none', the focus is dropped, which shows the failure mode for comparison.

Planned API surface

focusRestoration: 'byKey' | 'byIndex' | 'none'focusFallback: 'nearestRow' | 'sameIndex' | 'gridContainer'onFocusRestoredonFocusLost

Acceptance criteria

  • With byKey, document.activeElement is the cell for the same rowKey and colId after any re-render. (pending)
  • Column reordering keeps the focus on the same column id. (pending)
  • Deleting the focused row moves focus per focusFallback, never to document.body. (pending)
  • Restoration does not scroll unless the target is off-screen. (pending)
  • onFocusLost fires only when no fallback is possible. (pending)