Skip to content

GhostDataGrid specification ​

Important

Status: Approved on 2026-11-30 by zprue743 (see Approval). It contains the flat grid keyboard navigation contract, recorded as "Flat DataGrid keyboard decisions for 0.3.0" for the fully mounted, single-cell estimate editor (originally tracked as GHO-252), and the single-cell editing contract: public API, editRequest, consumer data, rendering, environment, and customization scenarios. The keyboard decisions G1–G10 are recorded and the editing decisions E1–E10 are approved; both are folded into the sections below. It is not covered by the approved GhostDataTable specification. Hierarchical treegrid and virtualized-row navigation remain separate design work (see Deferred: treegrid and Deferred: virtualized rows).

Purpose and user problems ​

Phase one deliberately keeps GhostDataTable a native <table> with ordinary Tab order (ADR 0014). Spreadsheet-style editing needs a different keyboard model: a planner moves between cells with the arrow keys, opens an editor on one cell, and returns to the same cell after the application accepts the edit and reorders the rows. This specification holds the keyboard, focus, and single-cell editing contract for that flat grid. It follows the WAI-ARIA APG data grid pattern.

The motivating workflow: a planner changes Build's estimate from 3 to 8. The application accepts the edit and reorders the rows by estimate. Because the planner submitted with Enter, focus follows Build's Estimate cell to its new position. If the application rejects the edit, the planner hears and sees the reason, and the cell still shows 3. See the estimate-edit walkthrough.

It defines:

  • a named, headless grid with one page Tab stop in navigation mode;
  • arrow, Home / End, Ctrl+Home / Ctrl+End, and Page Up / Page Down movement, including RTL;
  • pointer activation of a cell in navigation mode;
  • read-only cells and the handoff between navigation mode and an editable cell's labeled single-line editor, from the keyboard and from touch or mouse;
  • the editRequest proposal and the application-owned parsing, validation, saving, ordering, and rejection;
  • active-cell identity, focus recovery, and draft invalidation across insertion, reordering, removal, and external value changes, including the empty grid; and
  • the evidence the implementation must provide.

Non-goals ​

  • Hierarchy, expand and collapse, and role="treegrid" (deferred).
  • Rows that are not mounted (deferred).
  • Range or multi-cell selection and Shift+arrow extension. Row or cell selection owned by the grid, including aria-selected. Selection in the estimate workflow is application state outside the grid.
  • Sorting, filtering, and pagination inside the grid. The application orders data; the grid renders it in array order. These stay with GhostDataTable and the application.
  • Parsing, validation, saving, optimistic updates, and pending-save UI. The grid proposes text; the application decides. A pending indicator, if any, is rendered by the application through the cell render hook.
  • Multi-line, rich, select, date, or other custom editors; type-to-edit; clear-on-Delete; clipboard paste into cells; undo. 0.3.0 has exactly one editor: a native single-line text input.
  • Header cells as focus targets and controls inside column headers. In 0.3.0, column headers are plain labels outside the navigation sequence. A sorting control sits outside the grid in normal page Tab order. In-grid header actions need a later design that preserves the grid's single Tab stop (G5).
  • Links, buttons, and other widgets embedded in cells. 0.3.0 supports display content and the specified single-line editor only. Embedded widgets wait for a keyboard contract for reaching, operating, and leaving them (G4).
  • A themed GhostDataGrid in @ghostvue/themes. This specification is the headless layer; a themed wrapper is separate work, as it was for DataTable.
  • Any change to GhostDataTable. It keeps native semantics and ordinary Tab traversal (Compatibility).

Public API ​

Exports ​

ExportPackageRole
GhostDataGrid@ghostvue/vueHeadless generic component (generic="TData") that renders the grid.
useGhostDataGrid@ghostvue/vueState, identity, navigation, and editing engine behind GhostDataGrid.
DataGridColumnDef, DataGridCellKey, …@ghostvue/vuePublic types listed below.

Row identity types are reused from DataTable, not duplicated: DataTableRowId, DataTableGetRowId, and DataTableRow.

Types (exact contracts) ​

ts
import type { ComputedRef, MaybeRefOrGetter, Ref, VNodeChild } from 'vue'
import type {
  DataTableGetRowId,
  DataTableRow,
  DataTableRowId,
} from '@ghostvue/vue'

/** One data cell, identified by stable IDs, never by DOM position or index. */
export interface DataGridCellKey {
  rowId: DataTableRowId
  columnId: string
}

/**
 * Consumer-owned column definition. The grid reads it and never mutates it.
 * `id`, `accessorKey`, `accessorFn`, `cell`, and `meta` follow the DataTable
 * column conventions; the remaining fields are grid-only.
 */
export interface DataGridColumnDef<TData> {
  /** Stable column ID; the column half of every cell key. Unique per grid. */
  id: string
  /** Plain column header text. Also the default editor label prefix. */
  header: string
  accessorKey?: keyof TData & string
  accessorFn?: (row: TData, index: number) => unknown
  /** Display render hook, invoked as `cell(context)`. Never renders the editor. */
  cell?: (context: DataGridCellContext<TData>) => VNodeChild
  /** Renders this column's body cells as `rowheader`. At most one column. @default false */
  rowHeader?: boolean
  /** Whether a body cell opens the editor. Evaluated per row. @default false */
  editable?: boolean | ((row: TData, rowId: DataTableRowId) => boolean)
  /**
   * Text the editor opens with. Also the baseline for "changed" (E4) and for
   * external-change invalidation (E7).
   * @default value == null ? '' : String(value)
   */
  toDraftText?: (value: unknown, row: TData) => string
  /** Accessible name of the editor. @default `${header}, ${rowHeaderText}` */
  editorLabel?: (context: DataGridEditorLabelContext<TData>) => string
  /** `inputmode` for the editor; affects the touch keyboard only. @default 'text' */
  editorInputMode?: 'text' | 'numeric' | 'decimal'
  /** Opaque consumer metadata; the grid never reads it. */
  meta?: Record<string, unknown>
}

export interface DataGridCellContext<TData> {
  row: TData
  rowId: DataTableRowId
  /** Index of `row` in the `data` array that was passed in. */
  rowIndex: number
  column: DataGridColumnDef<TData>
  /** Runtime value is unknown, as in DataTable. */
  getValue: () => unknown
  /** Result of `column.editable` for this row. */
  editable: boolean
  /** Message of the matching `cellErrors` entry, if any. */
  error: string | undefined
}

export interface DataGridEditorLabelContext<TData> {
  row: TData
  rowId: DataTableRowId
  column: DataGridColumnDef<TData>
  /** Display text of this row's `rowHeader` cell, if the grid has one. */
  rowHeaderText: string | undefined
}

/** The single proposal the grid emits for a changed draft. */
export interface DataGridEditRequest {
  readonly rowId: DataTableRowId
  readonly columnId: string
  /** Accessor value captured when the editor opened; by reference, never cloned. */
  readonly previousValue: unknown
  /** The editor's text at submission, exactly as typed (not trimmed). */
  readonly draftText: string
}

/** App-controlled rejection or validation message shown on one cell. */
export interface DataGridCellError extends DataGridCellKey {
  /** Complete, localized sentence. Shown visibly and announced once. */
  message: string
}

export interface UseGhostDataGridOptions<TData> {
  /** Consumer-owned rows in display order. Read by reference; never mutated. */
  data: MaybeRefOrGetter<readonly TData[]>
  /** Consumer-owned columns in reading order. Never mutated. */
  columns: MaybeRefOrGetter<readonly DataGridColumnDef<TData>[]>
  /** Required in every build; there is no index fallback. */
  getRowId: DataTableGetRowId<TData>
  /** @default [] */
  cellErrors?: MaybeRefOrGetter<readonly DataGridCellError[] | undefined>
  onEditRequest?: (request: DataGridEditRequest) => void
}

export interface UseGhostDataGridReturn<TData> {
  /** Rows in display order; same shape as DataTable row models. */
  rows: ComputedRef<readonly DataTableRow<TData>[]>
  columns: ComputedRef<readonly DataGridColumnDef<TData>[]>
  /** Remembered active cell (the `Tab` target); `null` only for the empty grid. */
  activeCell: Readonly<Ref<DataGridCellKey | null>>
  /** Cell whose editor is open, or `null` in navigation mode. */
  editingCell: Readonly<Ref<DataGridCellKey | null>>
  isEditable: (cell: DataGridCellKey) => boolean
  /** Text for the polite status element rendered beside the grid. */
  statusMessage: Readonly<Ref<string>>
  /** Attribute and listener bags for custom markup. */
  getGridProps: () => Record<string, unknown>
  getRowProps: (rowId: DataTableRowId) => Record<string, unknown>
  getCellProps: (cell: DataGridCellKey) => Record<string, unknown>
  getEditorProps: () => Record<string, unknown>
  /** See "Events, callbacks, slots, and exposed methods". */
  focusCell: (cell: DataGridCellKey) => boolean
}

The exact attribute bags are implementation detail and are not documented as a markup contract. What they guarantee is the observable behavior in this specification.

Props and configuration ​

PropTypeDefaultNotes
datareadonly TData[]requiredDisplay order. The grid never sorts, filters, pages, clones, or mutates it.
columnsreadonly DataGridColumnDef<TData>[]requiredReading order. Column IDs must be unique.
getRowId(row: TData, index: number) => RowIdrequiredSame contract as DataTable's getRowId. Row IDs must be unique.
cellErrorsreadonly DataGridCellError[][]App-controlled messages; the grid never adds or clears entries.
  • Accessible name. aria-label and aria-labelledby are ordinary fallthrough attributes, not props. All fallthrough attributes, including class and style, go to the grid element (inheritAttrs: false). In development the grid warns once when neither name attribute is present.
  • Duplicate IDs. In development the grid warns once per duplicate row or column ID. Behavior with duplicates is unsupported; the first occurrence wins for identity.
  • Row header. In development the grid warns when more than one column sets rowHeader, and uses the first.
  • Editor label. Without a rowHeader column and without editorLabel, the default label is the column header alone, and development builds warn that editors in different rows share one name.

v-model contracts ​

None. data is application state that the grid proposes changes to but never writes, so there is no v-model for values. The active cell is internal, uncontrolled state: a controlled active cell would let the application move DOM focus implicitly, which the focus rules forbid. Applications that need to move focus call focusCell.

Events, callbacks, slots, and exposed methods ​

editRequest event (onEditRequest in the composable). Payload DataGridEditRequest ({ rowId, columnId, previousValue, draftText }).

  • Emitted at most once per editor session, and only when the draft is changed: draftText !== toDraftText(previousValue, row) by exact string comparison (E4). An unchanged draft emits nothing.
  • Emitted from Enter (not composing) and from Tab / Shift+Tab. Never from Escape, focus loss, outside presses, focusCell, removal, or invalidation.
  • On Enter, the grid first closes the editor and restores focus to the cell, then emits, so a handler that reorders rows runs with the grid already in navigation mode (E3). On Tab / Shift+Tab, the grid emits during the keydown without calling preventDefault(), lets the browser's default focus move leave the grid from the still-mounted editor, and unmounts the editor after focus has left.
  • The handler's return value is ignored, and the grid does not await it. The application parses draftText, validates, saves, and then either updates data (acceptance) or sets a cellErrors entry (rejection). previousValue lets the application detect that the stored value changed underneath the edit when cell values are primitives or are replaced rather than mutated in place. Because it is passed by reference, an object value mutated in place arrives already changed; an application that mutates objects should carry its own version field and snapshot it when the editor opens.
  • The grid never changes the displayed value itself. Until the application changes data, the cell keeps showing the old value.

cellErrors (rejection). See Acceptance and rejection for the rendered result.

Slots.

  • empty: accessible empty-state content shown inside the empty grid. In development the grid warns when data is empty and no empty slot is provided, because the empty grid must expose an empty state.
  • Display content of body cells comes from column.cell, as in DataTable. There are no per-column named slots in 0.3.0, and the editor cannot be replaced.

Exposed method focusCell(cell). Moves real DOM focus to the cell with that row and column ID in navigation mode and makes it the active cell and the Tab stop. Returns false and does nothing when the cell does not exist. If an editor is open, the draft is discarded without emitting (the same as focus leaving the editor, E5). It never opens the editor. It is the only way the application moves focus into the grid.

useGhostDataGrid ​

GhostDataGrid is the supported path and is a thin renderer over useGhostDataGrid. The composable is exported as the progressive escape hatch for applications that must render their own grid markup. Custom markup must render every row in rows order and every column in columns order, spread the returned attribute bags on the grid, row, cell, and editor elements, mount one editor input only for editingCell, and render statusMessage in a polite status element outside the grid element. The behavior and tests in this specification apply to GhostDataGrid; custom markup that drops a bag or reorders cells is unsupported.

Acceptance and rejection ​

vue
<script setup lang="ts">
import { ref } from 'vue'
import {
  GhostDataGrid,
  type DataGridCellError,
  type DataGridColumnDef,
  type DataGridEditRequest,
  type DataTableRowId,
} from '@ghostvue/vue'

import { saveEstimate } from './api'

interface Task {
  id: string
  name: string
  owner: string
  estimate: number
}

const tasks = ref<Task[]>([
  { id: 'design', name: 'Design', owner: 'Ana', estimate: 2 },
  { id: 'build', name: 'Build', owner: 'Ben', estimate: 3 },
  { id: 'test', name: 'Test', owner: 'Cy', estimate: 5 },
])
const cellErrors = ref<DataGridCellError[]>([])

const columns: DataGridColumnDef<Task>[] = [
  { id: 'task', header: 'Task', accessorKey: 'name', rowHeader: true },
  { id: 'owner', header: 'Owner', accessorKey: 'owner' },
  {
    id: 'estimate',
    header: 'Estimate',
    accessorKey: 'estimate',
    editable: true,
    editorInputMode: 'numeric',
  },
]

// The app owns ordering: rows are kept sorted by estimate, then name.
function byEstimate(rows: readonly Task[]): Task[] {
  return [...rows].sort(
    (a, b) => a.estimate - b.estimate || a.name.localeCompare(b.name),
  )
}

function setError(request: DataGridEditRequest, message: string | null) {
  cellErrors.value = cellErrors.value.filter(
    (e) => e.rowId !== request.rowId || e.columnId !== request.columnId,
  )
  if (message) {
    cellErrors.value.push({
      rowId: request.rowId,
      columnId: request.columnId,
      message,
    })
  }
}

// The app owns ordering of concurrent saves. Saves for one cell run one at a
// time, in proposal order, and each result is applied when it arrives, so the
// rows always match what the server last accepted. Keying by the typed row ID,
// then the column ID, keeps distinct IDs such as `1` and `'1'` apart.
const queues = new Map<DataTableRowId, Map<string, Promise<void>>>()

function enqueue(
  rowId: DataTableRowId,
  columnId: string,
  run: () => Promise<void>,
): Promise<void> {
  let byColumn = queues.get(rowId)
  if (!byColumn) {
    byColumn = new Map()
    queues.set(rowId, byColumn)
  }
  // A failed save must not stall the saves queued behind it.
  const previous = byColumn.get(columnId) ?? Promise.resolve()
  const next = previous.catch(() => undefined).then(run)
  byColumn.set(columnId, next)
  // Drop settled entries so rows that come and go don't accumulate.
  const forget = () => {
    const columns = queues.get(rowId)
    if (columns?.get(columnId) !== next) return
    columns.delete(columnId)
    if (columns.size === 0) queues.delete(rowId)
  }
  next.then(forget, forget)
  return next
}

function onEditRequest(request: DataGridEditRequest) {
  if (request.columnId !== 'estimate') return
  // Validation joins the same queue, so a newer proposal's error is never
  // overwritten by an older save that settles after it.
  return enqueue(request.rowId, request.columnId, async () => {
    const task = tasks.value.find((t) => t.id === request.rowId)
    if (!task) return
    setError(request, null)
    const estimate = Number(request.draftText.trim())
    if (!Number.isInteger(estimate) || estimate < 1) {
      setError(
        request,
        `${task.name} estimate not saved: enter a whole number of days.`,
      )
      return
    }
    const result = await saveEstimate(task.id, estimate, task.estimate)
    if (!result.ok) {
      // Rejection: data is untouched, so the cell keeps its last saved value.
      setError(request, `${task.name} estimate not saved: ${result.reason}`)
      return
    }
    setError(request, null)
    // Acceptance: a new array in a new order; focus follows the IDs.
    tasks.value = byEstimate(
      tasks.value.map((t) => (t.id === task.id ? { ...t, estimate } : t)),
    )
  })
}
</script>

<template>
  <GhostDataGrid
    aria-label="Sprint tasks"
    :data="tasks"
    :columns="columns"
    :get-row-id="(task) => task.id"
    :cell-errors="cellErrors"
    @edit-request="onEditRequest"
  >
    <template #empty>No tasks in this sprint.</template>
  </GhostDataGrid>
</template>
  • Acceptance. The application replaces data. The grid re-indexes rows by ID; Build's Estimate cell keeps the same key, so focus, which Enter already returned to that cell, follows it to the new position.
  • Rejection. data is unchanged, so the cell shows 3. The application's cellErrors entry for Build's Estimate is rendered as visible text in the cell, referenced by the cell's aria-describedby, exposed with data-invalid="true", and announced once through the polite status element. If the planner reopens the editor, it starts from 3 (not the rejected 8, E6), and the input has aria-invalid="true" and the same description until the application removes the entry.

State model ​

The grid has two keyboard modes: navigation mode, in which a data cell (or the empty grid) holds focus, and edit mode, in which an editable cell's labeled editor holds focus. The keys that move between them are in Keyboard interaction: edit mode.

Internal state is the remembered active cell key, the editing cell key (or null), and, while editing, the draft text, the opening baseline text (toDraftText(previousValue, row)), and previousValue. The draft lives only in the editor; no other cell re-renders while typing.

FromTriggerToEmitsFocus
NavigationEnter / F2 on an editable cellEditnothingEditor, whole draft selected (E1)
NavigationCompleted primary press on the already active, focused editable cellEditnothingEditor, whole draft selected (E2)
EditEnter, not composingNavigationchanged onlySame cell (by IDs)
EditEscape, not composingNavigationnothingSame cell
EditTab / Shift+TabNavigationchanged onlyNext / previous page stop
EditFocus leaves the editor for anything else (outside press, focusCell)NavigationnothingWherever it went; not reclaimed
EditEdited row or column removedNavigationnothingRecovered cell (or empty grid)
EditEdited cell's draft baseline changes, or it becomes read-onlyNavigationnothingSame cell
EditRows or columns inserted or reorderedEditnothingStays in the editor

Identity and recovery ​

  • Identity. The active cell is a pair of a row ID and a column ID, not a DOM position or index. Row IDs follow DataTable's required getRowId convention (Row identity); column IDs are the column definition IDs. Inserting or reordering rows or columns keeps the same cell active.
  • Recovery order. One update can remove the active row, the active column, or both. Recovery resolves the row first, then the column, each against that axis's pre-update order (display order for rows, reading order for columns). On each axis:
    1. If the active ID survives, keep it.
    2. Otherwise take the next surviving ID after it in the pre-update order, else the previous surviving ID before it.
    3. If no pre-update ID on that axis survives (every old ID was replaced), take the first new ID in display order (rows) or reading order (columns).
  • One result. The grid applies the final row and column pair once. It does not focus an intermediate cell between the row and column steps.
  • No data cell left. If either axis is empty after the update, the grid becomes the named, focusable empty grid with an accessible empty state and an ordinary Tab exit.
  • Focus inside the grid. When the active cell holds DOM focus and is replaced by recovery, focus moves to the recovered cell (or to the empty grid). When the active cell survives but its element is moved by the update (for example an accepted reorder) and the move drops DOM focus, the grid refocuses the same cell after the update.
  • Focus outside the grid. When DOM focus is elsewhere, recovery and reordering only update the remembered entry target. The grid never moves DOM focus in that case, including after external data updates.
  • Empty to populated. When the first data cell becomes available and the empty grid itself still holds DOM focus, real focus and the sole Tab stop move to the first body cell in reading order. If DOM focus has left the grid, that cell becomes the entry target and the user's focus stays where it is.

Draft invalidation ​

While an editor is open, each update to data or columns is checked against the editing cell key before focus or recovery is applied:

  • Insertion or reorder of rows or columns: the editor stays open with its draft, caret, and selection. If the browser drops focus when the row element moves, the grid refocuses the editor and restores its selection range; this internal blur is not "focus leaving the editor". A browser may end an active IME composition when an element moves; that never submits.
  • Removal of the edited row or column: the draft is discarded without emitting, and recovery picks the new active cell; because the editor held focus, focus moves to the recovered cell (or the empty grid).
  • External value change: if toDraftText of the edited cell's current value differs from the baseline captured at opening, the draft is discarded without emitting and focus returns to the same cell, which then announces its new value. Comparing the draft text rather than the raw value means a new row object with the same value does not invalidate the draft. Changes to other cells affect the draft only through toDraftText: with a callback that reads only value they never do, but a callback that also reads other row fields makes those fields part of the baseline, so changing them discards the draft.
  • Becoming read-only: if editable becomes false for the edited cell, the draft is discarded the same way.

Invalidation is observed through Vue reactivity, as in DataTable: a new data reference or a reactive change the accessor reads. In-place mutation of a non-reactive row object is not observed.

Loading, empty, disabled, read-only, and error states ​

  • Read-only is per cell (editable), not a grid-wide state. Read-only cells stay in navigation.
  • Empty is defined in Identity and recovery and Semantics.
  • Error is the application's cellErrors. Errors and read-only state are independent: an error on a read-only cell is still shown.
  • There is no grid-level loading or disabled prop in 0.3.0. An application that must block edits while loading makes cells read-only.

Async behavior ​

The grid has no async work. Saves are application-owned and may resolve out of order; the application decides how to order them (the example runs saves for one cell one at a time, in proposal order, and applies each result as it arrives, so the rows match what the server last accepted). Rows reordered or removed while a save is pending follow the ordinary identity and recovery rules. A cellErrors entry for a cell that no longer exists is ignored.

Consumer data ​

  • Shared conventions with DataTable. getRowId is required in every build with no index fallback; accessorKey / accessorFn resolve values with the same precedence and the same (row, index) arguments; cell receives a context with the same row, rowId, rowIndex, column, and getValue fields; meta is opaque.
  • Read by reference. data and columns are never cloned, deep-watched, or mutated. previousValue is the accessor result, passed by reference, so it is a reliable baseline only for primitive or replaced (immutable) values.
  • Display order is array order. The grid renders rows in data order and columns in columns order. Ordering, including reordering after an accepted edit, is the application's.
  • Stable row IDs across reorder and replacement are what make focus follow a cell. An application that mints new IDs on save loses focus recovery to the recovery rules.
  • Draft text. toDraftText must be pure and deterministic, because it is also the baseline for change detection and invalidation. Prefer a callback that formats only value; any other row field it reads becomes part of the invalidation baseline.
  • Selection and other per-row application state (for example, which task's details are open) live in the application. The grid neither reads nor changes them.

Accessibility contract ​

Semantics and focus model ​

  • Named grid. The grid has an accessible name and follows the APG data grid pattern (grid, row, columnheader, rowheader, gridcell).
  • One page Tab stop in navigation mode, roving tabindex. Focus rests on the actual cell element, so exactly one data cell (the active cell) is in the page Tab sequence and every other cell is focusable only programmatically. The grid does not use aria-activedescendant, because "focus rests on the actual cell".
  • One page Tab stop in edit mode. While an editor is open, the editor is the grid's only Tab stop and the active cell's tabindex is -1, so native Tab and Shift+Tab leave the grid instead of landing on the cell (E8). The cell's tabindex returns to 0 when the editor closes.
  • Data cells. Every data cell participates in navigation, whether or not it is editable. A read-only data cell exposes aria-readonly="true". An editable cell omits aria-readonly and has a labeled single-line editor that is mounted only in edit mode. "Data cell" and "body cell" mean the same thing in this specification.
  • Row headers. A body cell that labels its row, such as Task, keeps its rowheader semantics and is a data cell for navigation. It participates in roving focus, including first entry, Home, and Ctrl+Home when it is the first column in reading order. Enter and F2 on a read-only row header leave focus on it.
  • Cell content. A cell holds display content or the specified single-line editor. Links, buttons, and other widgets inside cells are not supported in 0.3.0 (see Non-goals).
  • Column headers. Plain column headers provide the cell's column label and are never focused by grid navigation. They contain no controls in 0.3.0. A sorting control for the grid sits outside the grid in normal page Tab order.
  • Empty grid. With no data cell available, the grid element itself is named and focusable, exposes an accessible empty state, and is the page Tab stop. Tab and Shift+Tab leave it like any other single stop.
  • Visible focus. The focused cell, and the empty grid when it holds focus, must show a visible focus indicator. Styling belongs to the themed layer; the headless contract only guarantees that the focused element is the real cell (or grid) so :focus-visible applies.

Editor semantics ​

  • The editor is a native <input type="text"> rendered inside the editing cell, with an accessible name from editorLabel (default "Estimate, Build"), autocomplete="off", enterkeyhint="done", and the column's inputmode.
  • The editor inherits the cell's text direction; the grid sets no dir.
  • When the cell has a cellErrors entry, the editor has aria-invalid="true" and aria-describedby pointing at the cell's error text.
  • Error text IDs come from the library's SSR-stable ID helper, so aria-describedby matches across server and client rendering.

Keyboard interaction: navigation mode ​

"Reading order" means the inline direction of the grid's writing mode: left to right in LTR, right to left in RTL. "Displayed row" means the rows currently rendered, in display order. Navigation changes focus only; it never edits, selects, sorts, or changes the page.

KeyBehavior
Tab (into the grid)First entry focuses the first data cell in reading order. Re-entry focuses the remembered active cell when it still exists (see Identity and recovery). With no data cell, focuses the named empty grid.
Shift+Tab (into grid)Same target as Tab: the grid has one stop, so reverse entry lands on the same remembered or first cell.
Tab / Shift+TabFrom a focused cell or the empty grid, leave the grid in the corresponding direction. The active cell is remembered for re-entry.
ArrowRightMove to the physical right-hand neighbor in the same row. In RTL that is the previous cell in reading order. Stops at the boundary: in LTR, ArrowRight on Build's last cell, Estimate, keeps focus there.
ArrowLeftMove to the physical left-hand neighbor in the same row. In RTL that is the next cell in reading order. Stops at the boundary.
ArrowDownMove one displayed row down in the same column. From Build's Estimate, reach the next task's Estimate if one exists; on the last row, focus stays.
ArrowUpMove one displayed row up in the same column. On the first row, focus stays.
HomeFirst data cell of the current row in reading order (the rightmost cell in RTL).
EndLast data cell of the current row in reading order (the leftmost cell in RTL).
Ctrl+HomeFirst data cell of the whole grid in reading order (first row, first cell). The same chord on every platform, including macOS.
Ctrl+EndLast data cell of the whole grid in reading order (last row, last cell). The same chord on every platform, including macOS.
Page DownSame column, forward by max(1, count − 1) rows, where count is the number of fully visible data rows (Page size). Clamped to the last row.
Page UpSame column, back by the same step. Clamped to the first row.
Enter / F2On an editable cell, open its labeled editor and move focus into it (Edit mode). On a read-only cell, including a read-only row header, nothing opens and focus stays on the cell. These are the only keyboard paths into editing.

Every movement key reveals its target as needed, so a cell reached by Page Down, Ctrl+End, or an arrow key in a scrolled viewport is scrolled into view. At every boundary (first and last row, first and last cell of a row) a movement key leaves focus where it is; it never wraps to another row or leaves the grid.

The grid handles Ctrl+Home and Ctrl+End with the Ctrl modifier on every platform. It does not handle Cmd (Meta) chords such as Cmd+ArrowUp or Cmd+Home; macOS and the browser keep them. This gives the grid one documented shortcut pair and preserves native editor behavior.

Page size ​

At each Page Up or Page Down keypress, the grid counts the data rows that are fully visible in the visible part of the grid body:

  • The visible area is the grid's own scroll container when it has one, clipped by every enclosing scroll container and by the document viewport. When the page, not the grid, scrolls the grid, the visible area is the document viewport.
  • Header rows are not counted, and neither is a row that is only partly visible (clipped by any of those boundaries).
  • The step is max(1, count − 1) rows in the same column, clamped at the first or last row, and the target is revealed.

A sliver of a row at an edge cannot inflate the step, and a row taller than the visible area (count 0) still moves one row, so the key always makes progress until the boundary.

Unhandled keys ​

In navigation mode the grid leaves Space, printable characters, Delete, Backspace, Escape, and Shift+arrows unhandled. It does not call preventDefault() for them, so their browser defaults (for example Space scrolling the page) still apply, and an Escape in navigation mode still reaches an enclosing dialog. They never change the active cell, open an editor, or change the cell's value; there is no type-to-edit or clear-on-Delete in 0.3.0. Other keys not listed in the table are also left to the browser.

Pointer activation ​

  • A completed primary click or tap on a body cell makes that cell the active cell and the remembered Tab target, including a read-only cell or row header. In navigation mode the cell receives DOM focus, so later keyboard navigation starts from it.
  • A press that becomes a scroll, or a press that is canceled (for example pointercancel, or a release outside the cell), does not activate the cell and leaves the active cell unchanged.
  • Pointer entry into editing (E2). A completed primary click or tap on the cell that is already the active, focused cell opens its editor when the cell is editable, with the whole draft selected. The first press on an inactive cell only activates it, so a mouse double-click and two separate taps both open the editor, and a single tap never surprises the user with a virtual keyboard. A press on a read-only active cell does nothing further.
  • Pointer dismissal (E5). While an editor is open, a completed press anywhere outside the editor moves focus out of it, and the draft is discarded without emitting. Focus is not reclaimed: it stays where the press put it. If the press lands on another body cell of the same grid, that cell is then activated and focused by the ordinary rule above. If it lands on a non-focusable area, focus goes where the browser puts it (usually the document body), and the edited cell remains the remembered Tab target. A press that becomes a scroll does not move focus and does not discard.

Keyboard interaction: edit mode ​

Edit mode starts from Enter or F2 on an editable cell, or from a press on the already active editable cell (Pointer activation). On entry the editor receives real focus with its whole draft selected (E1), and the editor owns the caret and IME.

KeyBehavior
Arrows, Home, EndNative caret movement and text selection in the editor. The grid does not move between cells while editing.
Composition keys (IME)The editor owns IME composition. An Enter that confirms a composition must not also submit the edit.
Enter (not composing)Closes the editor, restores focus to the cell, then proposes a changed draft once through editRequest. An unchanged draft proposes nothing.
Escape (composing)Belongs to the IME. The editor stays open, the draft keeps its value apart from the IME's own change, and no edit request is emitted.
Escape (not composing)Discards the draft and returns focus to the cell. The grid calls preventDefault() so an enclosing dialog does not also close (E10).
Tab / Shift+TabProposes a changed draft once and leaves the grid in the corresponding direction by the browser's default focus move. The edited cell becomes the remembered active cell.

Composition is detected with the library's existing isImeComposing check, which also covers WebKit's confirming Enter keydown that arrives after compositionend.

An Escape the IME uses, for example to cancel a composition, never discards the draft. A later ordinary Escape, pressed while no composition is active, discards the draft and restores focus to the cell.

"Restores focus to the cell" means the cell identified by the same row and column IDs. When the application accepts the edit and reorders the rows, focus follows that cell to its new position (see Identity and recovery). After a rejected edit, the cell keeps the value in data and shows the application's message (Acceptance and rejection).

Focus leaving the editor by any other route (an outside press, focusCell, the application focusing another control) discards the draft without emitting and does not reclaim focus (E5). The window or tab losing focus is not focus leaving the editor: the editor and draft remain when the user comes back.

Assistive technology expectations ​

  • Moving between cells announces the cell content with its column header, as the APG data grid pattern describes. Read-only cells announce their read-only state.
  • Entering edit mode moves focus into a labeled input, so the editor's name and value are announced. Leaving edit mode returns focus to a real cell, except for Tab / Shift+Tab and outside focus loss, where focus is wherever the user sent it.
  • A new cellErrors message is announced once through a polite status element rendered outside the grid element (a live region is not a valid child of grid). The message is also visible in the cell and referenced by aria-describedby, so it can be reviewed later. Errors already present at mount, including server-rendered ones, are not announced.
  • Screen-reader table commands keep working because the grid exposes rows, column headers, and cells, not a flat list.
  • Manual NVDA + Firefox and VoiceOver + Safari evidence is required before the grid is promoted to stable, per assistive-technology-review.md. Automated checks do not replace it.

Rendering and customization ​

  • Markup. GhostDataGrid renders a native <table role="grid"> built from the existing GhostTable parts, followed by a visually hidden polite status element. The wrapper nesting is not public API; the roles, names, states, and styling hooks below are.
  • Display content. column.cell(context) renders body cell content, with editable and error in the context. Without it, the cell shows toDraftText(getValue(), row).
  • Styling hooks (public, compatibility-reviewed like props): data-part="grid", "row", "columnheader", "cell", "editor", "cell-error", "empty", and "status"; on cells, data-active="true" for the remembered active cell, data-editing="true" while its editor is open, data-readonly="true" for read-only cells, and data-invalid="true" for cells with a cellErrors entry. Consumer class and style merge; they are never overwritten.
  • Scroll container. The grid does not create a scroll container. An application that wraps it in one must give that wrapper role="region" and an accessible name, per the repository rule for scrollable regions; page size is measured through it (Page size).
  • Lower level. useGhostDataGrid for custom markup, under the constraints in useGhostDataGrid.

Customization scenarios ​

Each task uses the public contract only; none relies on internal markup.

  1. Show a formatted value but edit the raw number. Show "3 days" while the editor opens with "3". Use cell to render the display text and toDraftText: (value) => String(value) for the editor; the app parses draftText in editRequest.
  2. Lock some rows. Tasks that are done must not be edited. Use editable: (task) => !task.done. Locked cells stay reachable, expose aria-readonly="true", and ignore Enter, F2, and the second press, as the navigation keys already specify.
  3. Reject an edit with a reason. The server refuses an estimate. Leave data unchanged and add a cellErrors entry with a full sentence; remove it on the next proposal for that cell. Focus already returned to the cell on Enter, so the announcement reaches the user without a focus change.
  4. Keep the grid sorted after a save. Replace data with a reordered array in editRequest. Because the cell key survives, focus follows the edited cell after Enter; after Tab, only the remembered re-entry target follows, since focus is outside the grid (Identity and recovery).
  5. Jump to a cell from an outside control. A "Go to first overrun" button calls the exposed focusCell({ rowId, columnId }). Focus enters the grid in navigation mode on that cell, which becomes the Tab stop; an open editor is discarded first (E5), and the editor never opens by itself. Rename or localize editor names, for example "Estimate for Build", with editorLabel.

Environment behavior ​

SSR and hydration ​

  • Server markup is deterministic for a given data, columns, and cellErrors: the first data cell in reading order (the first column definition of the first row) has tabindex="0", every other cell tabindex="-1", or the empty grid has tabindex="0" and its empty state. Reading order does not depend on direction, so no direction measurement is needed on the server.
  • No editor is ever server-rendered, and the status element renders empty. Server-rendered cellErrors produce visible text and aria-describedby with SSR-stable IDs and are not announced after hydration.
  • Hydration never moves focus. Direction (for arrow mapping) and page size are read only at keypress, in the browser.

Right-to-left ​

ArrowLeft / ArrowRight follow the physical neighbor using the grid element's computed direction at keypress, so inherited dir works; Home / End follow reading order. In the editor, the browser handles caret movement and bidirectional text; the grid handles no arrow keys there.

Mobile and touch ​

  • Touch entry is the second completed tap on the active editable cell (E2). The editor must receive focus within the handling of that tap so mobile browsers open the virtual keyboard; the implementation mounts the editor and focuses it without waiting for a later task. A manual iOS Safari and Android Chrome check confirms the keyboard opens.
  • editorInputMode selects the virtual keyboard; enterkeyhint="done" labels its return key, which sends Enter and proposes the draft.
  • On open, the editor is revealed (nearest alignment) so a virtual keyboard resizing the viewport does not hide it.
  • Scrolling with a touch press never activates a cell or discards a draft.
  • Known tradeoff: on iOS, hiding the virtual keyboard from the accessory bar blurs the editor, which discards the draft under E5. Accepted for 0.3.0 at approval (see Approval).
  • Target size and touch styling belong to the themed layer.

Performance ​

  • Scale. Fully mounted rows only: hundreds of rows and around ten columns (on the order of a few thousand cells). Larger data needs the deferred virtualized design. The 10k-row DataTable comparison is separate benchmark work and does not apply here.
  • Identity indexing. Row-ID and column-ID index maps are rebuilt in O(n) when the data or columns reference changes, so every movement key is O(1), and recovery is O(n) once per update, never per keypress.
  • Editing cost. The draft lives in the editor; typing re-renders no other cell. Invalidation evaluates toDraftText for the one editing cell per update.
  • Measurement. Page size reads row geometry at keypress only, and only for rows near the visible area; there are no scroll or resize listeners.
  • No deep work. No deep watchers on data, no copies of rows, and no per-cell reactive state beyond what rendering reads.

Composition ​

  • Reuses DataTableRowId, DataTableGetRowId, DataTableRow, and DataTable's accessor resolution (shared internally, not copied).
  • Renders through GhostTable parts so table styling hooks stay consistent.
  • Uses isImeComposing for composition-safe Enter and Escape, the library's SSR-stable ID helper for error descriptions, and GhostVisuallyHidden for the status element.
  • Does not use useGhostDataTable: the grid has no sort, filter, page, selection, or expansion pipeline, and running one would duplicate ordering that the application owns.
  • Does not use useDismissableLayer: the editor is not an overlay layer, and dismissal is defined by focus leaving the editor (E5), which also covers keyboard and programmatic focus moves that a pointer-outside listener would miss.

Estimate-edit walkthrough ​

The fixture is the acceptance and rejection example in LTR: rows Design (2), Build (3), Test (5), columns Task (row header, read-only), Owner (read-only), and Estimate (editable). Outside the grid, the application shows a "Details" panel whose selected task, Design, is application state chosen with an ordinary control before the grid in page order. The grid never reads or changes that state.

  1. Reach the cell. Tab from the details control enters the grid on Task, Design (first entry). ArrowDown reaches Task, Build; End reaches Build's Estimate (3). ArrowRight on that last LTR column keeps focus there. ArrowDown would reach Test's Estimate; ArrowUp returns.
  2. Escape. Enter opens the editor labeled "Estimate, Build" with "3" selected. Typing "8" replaces it; ArrowLeft and Home move the caret only. Escape discards; focus returns to Build's Estimate, which shows 3, and no editRequest is emitted. Design is still selected.
  3. Unchanged. F2 opens the editor; Enter without typing closes it and returns focus with no editRequest.
  4. Accept and reorder. Enter, type "8", Enter. Focus returns to Build's Estimate, then editRequest is emitted once with rowId: 'build', columnId: 'estimate', previousValue: 3, and draftText: '8'. The application saves and replaces data as Design (2), Test (5), Build (8). Focus is on Build's Estimate in the last row, found by row and column ID; ArrowUp reaches Test's Estimate. Design is still selected in the details panel.
  5. Reject. From the original data, the same edit is proposed and the application's save fails with a reason. data is unchanged, so Build's Estimate shows 3 with the visible message "Build estimate not saved: …", data-invalid="true", the message in its description, and one polite announcement. Focus stayed on the cell. Reopening the editor starts from "3" with aria-invalid="true". Design is still selected.
  6. Tab out and re-enter. With the editor open and "8" typed, Tab proposes once and moves focus to the next control after the grid. After an accepted reorder, Shift+Tab back into the grid lands on Build's Estimate at its new position.
  7. Outside press. With the editor open and "8" typed, clicking the details panel discards the draft without editRequest; focus stays in the panel, not on the cell. The next Tab into the grid lands on Build's Estimate.

Test plan ​

These cases provide the keyboard, focus, editing, type, and SSR evidence required for the implementation gate.

The fixture is a fully mounted, rectangular grid of tasks (for example Design, Build, and Test) whose last column, Estimate, is editable and whose other columns are read-only. Every Playwright case presses the documented key and asserts real DOM focus (toBeFocused()) and accessible state, never only tabindex values or pointer paths.

  • Framework-neutral unit tests (navigation helpers): next-cell computation for every key in LTR and RTL, including all four boundaries; Page Up / Page Down steps for fully visible row counts of 0, 1, 2, and more (max(1, count − 1)), with clamping; the fully visible row count when the grid's scroll container is clipped by an enclosing scroll container or the document viewport, excluding headers and partly visible rows; row and column recovery against the pre-update orders (surviving ID kept, next survivor, then previous, then the first new ID when every old ID was replaced), with the row resolved before the column and one final pair; and the transitions to and from the empty grid.
  • Framework-neutral unit tests (editing): "changed" is exact string inequality against toDraftText(previousValue, row) (trailing space counts as changed); invalidation decisions for insert, reorder, row removal, column removal, external value change (including a new object with the same value, which does not invalidate), and becoming read-only.
  • Vue component tests: exactly one cell has tabindex="0" at any time and it is the remembered active cell; while editing, no cell has tabindex="0" and the editor is the only tabbable element; read-only cells expose aria-readonly="true"; editable cells mount a labeled editor only in edit mode, with the default and custom editorLabel; the empty grid is named, focusable, and exposes its empty state; a rowheader cell keeps its role and is part of roving focus; column headers contain no focusable controls; external data updates while focus is outside the grid do not move document.activeElement; editRequest payload and once-only emission for Enter and Tab; no emission for unchanged drafts, Escape, outside focus loss, focusCell, removal, and invalidation; cellErrors renders visible text, aria-describedby, data-invalid, aria-invalid on a reopened editor, and one status announcement per new entry; data and columns are not mutated (frozen fixtures); development warnings for a missing name, duplicate IDs, multiple row headers, and a missing empty slot.
  • SSR: renderToString output for the fixture and for the empty grid matches the documented tabindex layout, contains no editor, and has matching error description IDs after hydration with no hydration warnings and no focus change. Reuse the apps/nuxt-fixture SSR app for one end-to-end hydration case.
  • Playwright keyboard and focus (chromium-e2e):
    • Tab into the grid focuses the first data cell in reading order on first entry, which is the Task row header when it is the first column; Tab and Shift+Tab leave in the corresponding direction; re-entry from either side lands on the remembered cell, including a read-only one.
    • Every arrow key, including at the first and last row and the first and last cell of a row. In LTR, ArrowRight on Build's Estimate stays put and ArrowDown reaches the next task's Estimate.
    • Horizontal navigation in dir="rtl": ArrowLeft / ArrowRight follow the physical neighbor, and Home / End follow reading order; in the RTL editor, arrows move the caret and not the active cell.
    • Home, End, Ctrl+Home, and Ctrl+End, with Home and Ctrl+Home reaching the Task row header. Meta+Home, Meta+End, Meta+ArrowUp, and Meta+ArrowDown do not move the active cell and are not default-prevented.
    • Page Up / Page Down in a scrolled grid viewport, asserting the step (max(1, count − 1) fully visible rows), clamping, and that the target is revealed.
    • Clipped page: Page Up / Page Down with the grid scrolled by the document and clipped by the document viewport and by an enclosing scroll container, with partly visible rows at both edges, asserting that clipped rows, slivers, and the header row are not counted; and with a row taller than the viewport, asserting that each press still moves one row until the boundary. Each press asserts the focused cell with toBeFocused().
    • Space, a printable character, Delete, Backspace, Escape, and Shift+arrows in navigation mode leave focus on the same cell, open no editor, leave the value unchanged, and are not default-prevented.
    • Enter and F2 open the editor on Estimate with the whole draft selected and the editor focused, and do nothing on a read-only cell or the read-only Task row header. While editing, arrows, Home, and End move the caret. An IME composition confirmed with Enter does not submit; the next Enter proposes the changed draft once and restores cell focus. An unchanged draft proposes nothing. Escape discards and returns focus.
    • Composing Escape, then ordinary Escape: with an IME composition active in Estimate's editor, Escape keeps the editor focused and open, keeps the draft apart from the IME's own change, and emits no edit request; a second Escape with no composition active discards the draft and returns focus to the Estimate cell. Tab and Shift+Tab propose once and leave the grid in the corresponding direction.
    • Escape inside a dialog: with the grid in a GhostDialog, Escape in the editor discards the draft and leaves the dialog open; a second Escape in navigation mode closes the dialog.
    • The full estimate-edit walkthrough: Escape, unchanged submission, acceptance with reorder leaving focus on Build's Estimate in its new row, rejection keeping 3 with the message, description, and announcement, Tab out and re-entry after reorder, and an outside press that discards without moving focus to the cell. Every path asserts the application-owned Design selection is unchanged.
    • Concurrent saves: with the documented per-cell queue, a second proposal for the same cell is not sent until the first save settles. If the first succeeds and the second is rejected, the cell shows the first value and the second's error, matching the server; if both succeed, the cell shows the second value. A valid proposal still saving followed by an invalid one for the same cell ends with the invalid proposal's error visible, because validation waits in the same queue.
    • Draft invalidation while editing: inserting a row above and reordering rows keep the editor focused with its draft and selection; removing the edited row or column discards without emitting and focuses the recovered cell; an external value change to the edited cell discards and focuses the cell; with a value-only toDraftText, an external change to another cell keeps the draft, and with a toDraftText that reads that other field, the change discards it.
    • Removing the focused row and removing the focused column recover focus per Identity and recovery; removing the last row leaves a named, focusable empty grid that Tab exits.
    • Simultaneous row and column replacement: one update that removes the focused cell's row and column moves focus once to the recovered pair (row first, then column, against the pre-update orders); an update that replaces every row ID or every column ID focuses the first new row or column; an update that empties either axis focuses the named empty grid. The same updates with focus outside the grid leave focus where it was and change only the re-entry target.
    • Repopulation from empty: with the empty grid focused, adding rows moves real focus to the first body cell in reading order, and that cell is the only Tab stop; with focus outside the empty grid, adding rows leaves focus where it was, and the next Tab into the grid lands on the first body cell.
    • An external update while focus is outside the grid leaves focus where it was and changes the re-entry target.
    • Pointer activation, then keyboard: clicking Build's Estimate, and separately tapping a read-only cell, focuses that cell; the next arrow key moves from it, and leaving and re-entering with Tab returns to it. A press that turns into a scroll, and a press canceled before release, leave the previous active cell and focus unchanged.
    • Pointer and touch editing (Chromium with touch emulation, and WebKit): the first tap on Build's Estimate only focuses it; the second tap opens the editor focused; a double-click opens it; a tap on another cell while editing discards and focuses that cell; a touch scroll while editing keeps the editor and draft; switching windows and returning keeps the draft.
  • axe: zero @axe-core/playwright violations in navigation mode, edit mode, with a visible cell error, and in the empty grid.
  • Type tests (*.test-d.ts): TData is inferred from data; accessorKey rejects non-keys; getRowId is required; editable and toDraftText callbacks receive TData; the editRequest handler receives DataGridEditRequest with rowId: DataTableRowId, columnId: string, previousValue: unknown, and draftText: string; cellErrors entries require message; focusCell accepts DataGridCellKey and returns boolean; no exported type uses any.
  • Manual: iOS Safari and Android Chrome open the virtual keyboard on touch entry; NVDA + Firefox and VoiceOver + Safari before promotion to stable.
  • Regression: the native DataTable keyboard fixture in tests/e2e/ghost-data-table.spec.ts (header sort buttons, checkboxes, expand buttons, focus on detail collapse) stays green unchanged, proving phase-one native semantics and Tab order are untouched.

Documentation plan ​

Written with the implementation, after approval:

  • docs/components/data-grid.md: purpose, when to use DataGrid instead of DataTable, generated props, events, slots, and exposed tables from the manifest, the keyboard tables for both modes, and the styling hooks.
  • Executable examples under examples/data-grid/: a basic read-only grid, the estimate editor with acceptance and reorder, rejection with cellErrors, locked rows, and an RTL grid. The estimate example doubles as the walkthrough fixture.
  • Accessibility guidance: naming the grid, writing complete error sentences, labeling editors with a row header or editorLabel, and naming a scroll wrapper.
  • Edge-case guidance: stable row IDs across saves, why focus follows on Enter but not after Tab, out-of-order saves, and draft invalidation.
  • The customization scenarios above, linked from the component page.
  • A manifest at packages/vue/manifests/ghost-data-grid.manifest.json generated with pnpm manifests:write, and a roadmap row update.

Compatibility and release impact ​

Native DataTable phase one is unchanged. GhostDataTable, GhostDataTableTable, and GhostDataTablePreset keep native <table> semantics, no role="grid", no arrow-key cell movement, and the Tab order in Keyboard interaction and Keyboard, focus parity, RTL, touch, and motion. Nothing here is opt-in on GhostDataTable; it applies only to the separate grid component this specification describes.

  • All exports are new and additive. The reused DataTable types are not changed. The implementation ships as experimental in a minor @ghostvue/vue release with a Changeset.
  • Focus movement, key handling, event timing (close-then-emit on Enter), data-* hooks, and the default editor label are public behavior from the first release; changing them later needs the same compatibility review as a prop rename.
  • Later additions (custom editors, in-cell widgets, header controls, treegrid, virtualization, a requestId) are designed to be additive to this contract.

This specification is documentation only and needs no Changeset.

Deferred: treegrid (hierarchy, expand and collapse) ​

Not part of 0.3.0. A separate design issue must answer at least:

  1. Row focus versus cell focus: can a whole row hold focus (APG treegrid allows both), and how do ArrowLeft / ArrowRight choose between collapsing, expanding, moving to the parent row, and moving between cells?
  2. Expand and collapse keys and their RTL mirroring, and whether Enter still means "edit" on an expandable row.
  3. aria-level, aria-setsize, aria-posinset, and aria-expanded placement, and how ArrowUp / ArrowDown, Page Up / Page Down, and Ctrl+Home / Ctrl+End treat collapsed descendants.
  4. Focus recovery when a collapse hides the active cell's row, and how that extends the removal rules above.
  5. How a treegrid relates to DataTable's existing expansion detail rows, which are not tree children.
  6. Lazily loaded children and their loading state.

Deferred: virtualized rows ​

Not part of 0.3.0; the flat grid above assumes every displayed row is mounted. The DataTable virtualization specification (#318) provides the hooks a later design should build on (see its Grid and treegrid navigation and Focus retention). That design must answer at least:

  1. How ArrowUp / ArrowDown, Page Up / Page Down, and Ctrl+Home / Ctrl+End reach an unmounted row (for example through scrollToRow(rowId) before moving focus), and how the visible-page step is measured with variable row heights.
  2. How the active cell's row stays mounted (focus pinning) while it is out of view, and how the remembered re-entry target survives being unmounted.
  3. Whether recovery's "next surviving row" may be an unmounted row and must be mounted before focus moves.
  4. aria-rowcount / aria-rowindex scope for the grid, aligned with the virtualization spec's V3 decision.
  5. Confirmation that grid mode replaces the virtualization spec's Tab traversal and focus catcher, as that spec already anticipates.
  6. How an open editor's row stays mounted, and whether draft invalidation treats unmounting as removal.

Recorded keyboard decisions (0.3.0) ​

On 2026-11-30, zprue743 decided G1–G10 in review on PR #625 for the 0.3.0 flat, fully mounted estimate editor. The sections above already state each decision; this list records where.

  1. G1: Modifier on macOS. Ctrl+Home / Ctrl+End on every platform; Cmd chords stay with macOS and the browser (Navigation mode).
  2. G2: Page size. max(1, count − 1) fully visible data rows, measured at each keypress in the clipped visible area (Page size).
  3. G3: Unlisted keys. Space, printable characters, Delete, Backspace, and Shift+arrows stay unhandled in navigation mode; Enter and F2 are the keyboard paths into editing (Unhandled keys).
  4. G4: In-cell controls. Display content and the single-line editor only; embedded widgets are deferred (Non-goals).
  5. G5: Header controls. Plain column headers; any sorting control sits outside the grid in page Tab order (Non-goals, Semantics).
  6. G6: Row headers. A rowheader body cell takes part in roving focus (Semantics).
  7. G7: Combined removal. Row first, then column, against the pre-update orders, applied once (Identity and recovery).
  8. G8: Empty to populated. Focus moves to the first body cell only when the empty grid still holds focus (Identity and recovery).
  9. G9: IME Escape. A composing Escape belongs to the IME; a later ordinary Escape discards the draft (Edit mode).
  10. G10: Pointer activation. A completed primary click or tap activates and focuses a body cell; scrolls and canceled presses do not (Pointer activation).

Resolved: spec placement (G11). On PR #625, zprue743 chose to keep this contract in this GhostDataGrid specification, separate from the approved DataTable specification.

Approved editing decisions (0.3.0) ​

zprue743 approved E1–E10 as written on 2026-11-30 (see Approval). Each is stated in the sections above. They were reconciled with G1–G10: no editing rule adds a navigation-mode key, changes the single Tab stop, or changes pointer activation of an inactive cell.

  1. E1: Entry selection. Enter, F2, and pointer entry open the editor with the whole draft selected, so typing replaces and arrows move the caret natively (Edit mode).
  2. E2: Pointer and touch entry. A completed press on the already active, focused editable cell opens the editor; the first press only activates it (consistent with G10) (Pointer activation).
  3. E3: Close, then emit, on Enter. Focus returns to the cell before editRequest, so an accepted reorder in the handler moves an already focused cell (Events).
  4. E4: Changed means different text. Exact string inequality against the opening text; no trimming or parsing by the grid (Events).
  5. E5: Focus loss discards. Any focus move out of the editor other than Enter, Escape, or Tab / Shift+Tab (an outside press, including on another cell, focusCell, or app focus) discards without emitting and does not reclaim focus; window blur keeps the draft (Edit mode).
  6. E6: Rejection is app-controlled. cellErrors drives visible text, aria-describedby, data-invalid, and one polite announcement; reopening starts from the current value (Acceptance and rejection).
  7. E7: Draft invalidation. Insert and reorder keep the draft; removal, external value change, and becoming read-only discard it without emitting (Draft invalidation).
  8. E8: Editor is the only Tab stop while editing. The cell leaves the Tab order and Tab is not default-prevented (Semantics).
  9. E9: No requestId in editRequest. The payload is exactly { rowId, columnId, previousValue, draftText }; ordering concurrent saves is the application's, with a documented per-cell save queue (Async behavior).
  10. E10: Escape scope. Edit-mode Escape is default-prevented so an enclosing dialog stays open; navigation-mode Escape is left to the page (Unhandled keys).

Approval ​

On 2026-11-30, zprue743 approved the whole specification, including E1–E10 and the proposed answers to the review questions that were open in the frontmatter. The approval is recorded in PR #649. It is a design approval only; it is not merge approval of any implementation or a release inclusion decision. Implementation may start against this contract.

Resolved review questions:

  1. requestId in editRequest (E9). No. The payload stays { rowId, columnId, previousValue, draftText }, and the application orders concurrent saves with the documented per-cell guard. A grid-minted requestId can be added later without breaking this payload.
  2. Reopening after a rejection (E6). Reopening the editor on the same cell always starts from the current value; a rejected draft is not offered again.
  3. iOS keyboard dismissal. Accepted for 0.3.0: hiding the virtual keyboard from the accessory bar blurs the editor and discards the draft under E5, as described in Mobile and touch.