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
Tabstop in navigation mode; - arrow,
Home/End,Ctrl+Home/Ctrl+End, andPage Up/Page Downmovement, 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
editRequestproposal 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, includingaria-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 withGhostDataTableand 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
cellrender hook. - Multi-line, rich, select, date, or other custom editors; type-to-edit; clear-on-
Delete; clipboard paste into cells; undo.0.3.0has 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 pageTaborder. In-grid header actions need a later design that preserves the grid's singleTabstop (G5). - Links, buttons, and other widgets embedded in cells.
0.3.0supports 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
GhostDataGridin@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 ordinaryTabtraversal (Compatibility).
Public API
Exports
| Export | Package | Role |
|---|---|---|
GhostDataGrid | @ghostvue/vue | Headless generic component (generic="TData") that renders the grid. |
useGhostDataGrid | @ghostvue/vue | State, identity, navigation, and editing engine behind GhostDataGrid. |
DataGridColumnDef, DataGridCellKey, … | @ghostvue/vue | Public types listed below. |
Row identity types are reused from DataTable, not duplicated: DataTableRowId, DataTableGetRowId, and DataTableRow.
Types (exact contracts)
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
| Prop | Type | Default | Notes |
|---|---|---|---|
data | readonly TData[] | required | Display order. The grid never sorts, filters, pages, clones, or mutates it. |
columns | readonly DataGridColumnDef<TData>[] | required | Reading order. Column IDs must be unique. |
getRowId | (row: TData, index: number) => RowId | required | Same contract as DataTable's getRowId. Row IDs must be unique. |
cellErrors | readonly DataGridCellError[] | [] | App-controlled messages; the grid never adds or clears entries. |
- Accessible name.
aria-labelandaria-labelledbyare ordinary fallthrough attributes, not props. All fallthrough attributes, includingclassandstyle, 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
rowHeadercolumn and withouteditorLabel, 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 fromTab/Shift+Tab. Never fromEscape, 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). OnTab/Shift+Tab, the grid emits during the keydown without callingpreventDefault(), 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 updatesdata(acceptance) or sets acellErrorsentry (rejection).previousValuelets 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 whendatais empty and noemptyslot 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 in0.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
<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, whichEnteralready returned to that cell, follows it to the new position. - Rejection.
datais unchanged, so the cell shows 3. The application'scellErrorsentry for Build's Estimate is rendered as visible text in the cell, referenced by the cell'saria-describedby, exposed withdata-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 hasaria-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.
| From | Trigger | To | Emits | Focus |
|---|---|---|---|---|
| Navigation | Enter / F2 on an editable cell | Edit | nothing | Editor, whole draft selected (E1) |
| Navigation | Completed primary press on the already active, focused editable cell | Edit | nothing | Editor, whole draft selected (E2) |
| Edit | Enter, not composing | Navigation | changed only | Same cell (by IDs) |
| Edit | Escape, not composing | Navigation | nothing | Same cell |
| Edit | Tab / Shift+Tab | Navigation | changed only | Next / previous page stop |
| Edit | Focus leaves the editor for anything else (outside press, focusCell) | Navigation | nothing | Wherever it went; not reclaimed |
| Edit | Edited row or column removed | Navigation | nothing | Recovered cell (or empty grid) |
| Edit | Edited cell's draft baseline changes, or it becomes read-only | Navigation | nothing | Same cell |
| Edit | Rows or columns inserted or reordered | Edit | nothing | Stays 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
getRowIdconvention (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:
- If the active ID survives, keep it.
- Otherwise take the next surviving ID after it in the pre-update order, else the previous surviving ID before it.
- 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
Tabexit. - 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
Tabstop 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
toDraftTextof 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 throughtoDraftText: with a callback that reads onlyvaluethey never do, but a callback that also reads otherrowfields makes those fields part of the baseline, so changing them discards the draft. - Becoming read-only: if
editablebecomesfalsefor 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
loadingordisabledprop in0.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.
getRowIdis required in every build with no index fallback;accessorKey/accessorFnresolve values with the same precedence and the same(row, index)arguments;cellreceives a context with the samerow,rowId,rowIndex,column, andgetValuefields;metais opaque. - Read by reference.
dataandcolumnsare never cloned, deep-watched, or mutated.previousValueis 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
dataorder and columns incolumnsorder. 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.
toDraftTextmust be pure and deterministic, because it is also the baseline for change detection and invalidation. Prefer a callback that formats onlyvalue; any otherrowfield 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
Tabstop in navigation mode, rovingtabindex. Focus rests on the actual cell element, so exactly one data cell (the active cell) is in the pageTabsequence and every other cell is focusable only programmatically. The grid does not usearia-activedescendant, because "focus rests on the actual cell". - One page
Tabstop in edit mode. While an editor is open, the editor is the grid's onlyTabstop and the active cell'stabindexis-1, so nativeTabandShift+Tableave the grid instead of landing on the cell (E8). The cell'stabindexreturns to0when 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 omitsaria-readonlyand 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
rowheadersemantics and is a data cell for navigation. It participates in roving focus, including first entry,Home, andCtrl+Homewhen it is the first column in reading order.EnterandF2on 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 pageTaborder. - Empty grid. With no data cell available, the grid element itself is named and focusable, exposes an accessible empty state, and is the page
Tabstop.TabandShift+Tableave 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-visibleapplies.
Editor semantics
- The editor is a native
<input type="text">rendered inside the editing cell, with an accessible name fromeditorLabel(default "Estimate, Build"),autocomplete="off",enterkeyhint="done", and the column'sinputmode. - The editor inherits the cell's text direction; the grid sets no
dir. - When the cell has a
cellErrorsentry, the editor hasaria-invalid="true"andaria-describedbypointing at the cell's error text. - Error text IDs come from the library's SSR-stable ID helper, so
aria-describedbymatches 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.
| Key | Behavior |
|---|---|
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+Tab | From a focused cell or the empty grid, leave the grid in the corresponding direction. The active cell is remembered for re-entry. |
ArrowRight | Move 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. |
ArrowLeft | Move to the physical left-hand neighbor in the same row. In RTL that is the next cell in reading order. Stops at the boundary. |
ArrowDown | Move 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. |
ArrowUp | Move one displayed row up in the same column. On the first row, focus stays. |
Home | First data cell of the current row in reading order (the rightmost cell in RTL). |
End | Last data cell of the current row in reading order (the leftmost cell in RTL). |
Ctrl+Home | First data cell of the whole grid in reading order (first row, first cell). The same chord on every platform, including macOS. |
Ctrl+End | Last data cell of the whole grid in reading order (last row, last cell). The same chord on every platform, including macOS. |
Page Down | Same 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 Up | Same column, back by the same step. Clamped to the first row. |
Enter / F2 | On 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
Tabtarget, 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
Tabtarget. 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.
| Key | Behavior |
|---|---|
Arrows, Home, End | Native 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+Tab | Proposes 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+Taband outside focus loss, where focus is wherever the user sent it. - A new
cellErrorsmessage is announced once through a polite status element rendered outside the grid element (a live region is not a valid child ofgrid). The message is also visible in the cell and referenced byaria-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.
GhostDataGridrenders a native<table role="grid">built from the existingGhostTableparts, 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, witheditableanderrorin the context. Without it, the cell showstoDraftText(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, anddata-invalid="true"for cells with acellErrorsentry. Consumerclassandstylemerge; 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.
useGhostDataGridfor custom markup, under the constraints inuseGhostDataGrid.
Customization scenarios
Each task uses the public contract only; none relies on internal markup.
- Show a formatted value but edit the raw number. Show "3 days" while the editor opens with "3". Use
cellto render the display text andtoDraftText: (value) => String(value)for the editor; the app parsesdraftTextineditRequest. - Lock some rows. Tasks that are done must not be edited. Use
editable: (task) => !task.done. Locked cells stay reachable, exposearia-readonly="true", and ignoreEnter,F2, and the second press, as the navigation keys already specify. - Reject an edit with a reason. The server refuses an estimate. Leave
dataunchanged and add acellErrorsentry with a full sentence; remove it on the next proposal for that cell. Focus already returned to the cell onEnter, so the announcement reaches the user without a focus change. - Keep the grid sorted after a save. Replace
datawith a reordered array ineditRequest. Because the cell key survives, focus follows the edited cell afterEnter; afterTab, only the remembered re-entry target follows, since focus is outside the grid (Identity and recovery). - 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 theTabstop; an open editor is discarded first (E5), and the editor never opens by itself. Rename or localize editor names, for example "Estimate for Build", witheditorLabel.
Environment behavior
SSR and hydration
- Server markup is deterministic for a given
data,columns, andcellErrors: the first data cell in reading order (the first column definition of the first row) hastabindex="0", every other celltabindex="-1", or the empty grid hastabindex="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
cellErrorsproduce visible text andaria-describedbywith 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.
editorInputModeselects the virtual keyboard;enterkeyhint="done"labels its return key, which sendsEnterand proposes the draft.- On open, the editor is revealed (
nearestalignment) 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.0at 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
dataorcolumnsreference 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
toDraftTextfor 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
GhostTableparts so table styling hooks stay consistent. - Uses
isImeComposingfor composition-safeEnterandEscape, the library's SSR-stable ID helper for error descriptions, andGhostVisuallyHiddenfor 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.
- Reach the cell.
Tabfrom the details control enters the grid on Task, Design (first entry).ArrowDownreaches Task, Build;Endreaches Build's Estimate (3).ArrowRighton that last LTR column keeps focus there.ArrowDownwould reach Test's Estimate;ArrowUpreturns. - Escape.
Enteropens the editor labeled "Estimate, Build" with "3" selected. Typing "8" replaces it;ArrowLeftandHomemove the caret only.Escapediscards; focus returns to Build's Estimate, which shows 3, and noeditRequestis emitted. Design is still selected. - Unchanged.
F2opens the editor;Enterwithout typing closes it and returns focus with noeditRequest. - Accept and reorder.
Enter, type "8",Enter. Focus returns to Build's Estimate, theneditRequestis emitted once withrowId: 'build',columnId: 'estimate',previousValue: 3, anddraftText: '8'. The application saves and replacesdataas Design (2), Test (5), Build (8). Focus is on Build's Estimate in the last row, found by row and column ID;ArrowUpreaches Test's Estimate. Design is still selected in the details panel. - Reject. From the original data, the same edit is proposed and the application's save fails with a reason.
datais 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" witharia-invalid="true". Design is still selected. - Tab out and re-enter. With the editor open and "8" typed,
Tabproposes once and moves focus to the next control after the grid. After an accepted reorder,Shift+Tabback into the grid lands on Build's Estimate at its new position. - 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 nextTabinto 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 Downsteps 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 hastabindex="0"and the editor is the only tabbable element; read-only cells exposearia-readonly="true"; editable cells mount a labeled editor only in edit mode, with the default and customeditorLabel; the empty grid is named, focusable, and exposes its empty state; arowheadercell 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 movedocument.activeElement;editRequestpayload and once-only emission forEnterandTab; no emission for unchanged drafts,Escape, outside focus loss,focusCell, removal, and invalidation;cellErrorsrenders visible text,aria-describedby,data-invalid,aria-invalidon a reopened editor, and one status announcement per new entry;dataandcolumnsare not mutated (frozen fixtures); development warnings for a missing name, duplicate IDs, multiple row headers, and a missingemptyslot. - SSR:
renderToStringoutput for the fixture and for the empty grid matches the documentedtabindexlayout, contains no editor, and has matching error description IDs after hydration with no hydration warnings and no focus change. Reuse theapps/nuxt-fixtureSSR app for one end-to-end hydration case. - Playwright keyboard and focus (
chromium-e2e):Tabinto 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;TabandShift+Tableave 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,
ArrowRighton Build's Estimate stays put andArrowDownreaches the next task's Estimate. - Horizontal navigation in
dir="rtl":ArrowLeft/ArrowRightfollow the physical neighbor, andHome/Endfollow reading order; in the RTL editor, arrows move the caret and not the active cell. Home,End,Ctrl+Home, andCtrl+End, withHomeandCtrl+Homereaching the Task row header.Meta+Home,Meta+End,Meta+ArrowUp, andMeta+ArrowDowndo not move the active cell and are not default-prevented.Page Up/Page Downin 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 Downwith 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 withtoBeFocused(). Space, a printable character,Delete,Backspace,Escape, andShift+arrows in navigation mode leave focus on the same cell, open no editor, leave the value unchanged, and are not default-prevented.EnterandF2open 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, andEndmove the caret. An IME composition confirmed withEnterdoes not submit; the nextEnterproposes the changed draft once and restores cell focus. An unchanged draft proposes nothing.Escapediscards and returns focus.- Composing
Escape, then ordinaryEscape: with an IME composition active in Estimate's editor,Escapekeeps the editor focused and open, keeps the draft apart from the IME's own change, and emits no edit request; a secondEscapewith no composition active discards the draft and returns focus to the Estimate cell.TabandShift+Tabpropose once and leave the grid in the corresponding direction. - Escape inside a dialog: with the grid in a
GhostDialog,Escapein the editor discards the draft and leaves the dialog open; a secondEscapein 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,
Tabout 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 atoDraftTextthat 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
Tabexits. - 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
Tabstop; with focus outside the empty grid, adding rows leaves focus where it was, and the nextTabinto 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
Tabreturns 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/playwrightviolations in navigation mode, edit mode, with a visible cell error, and in the empty grid. - Type tests (
*.test-d.ts):TDatais inferred fromdata;accessorKeyrejects non-keys;getRowIdis required;editableandtoDraftTextcallbacks receiveTData; theeditRequesthandler receivesDataGridEditRequestwithrowId: DataTableRowId,columnId: string,previousValue: unknown, anddraftText: string;cellErrorsentries requiremessage;focusCellacceptsDataGridCellKeyand returnsboolean; no exported type usesany. - 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 andTaborder 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 withcellErrors, 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
Enterbut not afterTab, 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.jsongenerated withpnpm 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
experimentalin a minor@ghostvue/vuerelease 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:
- Row focus versus cell focus: can a whole row hold focus (APG treegrid allows both), and how do
ArrowLeft/ArrowRightchoose between collapsing, expanding, moving to the parent row, and moving between cells? - Expand and collapse keys and their RTL mirroring, and whether
Enterstill means "edit" on an expandable row. aria-level,aria-setsize,aria-posinset, andaria-expandedplacement, and howArrowUp/ArrowDown,Page Up/Page Down, andCtrl+Home/Ctrl+Endtreat collapsed descendants.- Focus recovery when a collapse hides the active cell's row, and how that extends the removal rules above.
- How a treegrid relates to DataTable's existing expansion detail rows, which are not tree children.
- 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:
- How
ArrowUp/ArrowDown,Page Up/Page Down, andCtrl+Home/Ctrl+Endreach an unmounted row (for example throughscrollToRow(rowId)before moving focus), and how the visible-page step is measured with variable row heights. - 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.
- Whether recovery's "next surviving row" may be an unmounted row and must be mounted before focus moves.
aria-rowcount/aria-rowindexscope for the grid, aligned with the virtualization spec's V3 decision.- Confirmation that grid mode replaces the virtualization spec's
Tabtraversal and focus catcher, as that spec already anticipates. - 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.
- G1: Modifier on macOS.
Ctrl+Home/Ctrl+Endon every platform;Cmdchords stay with macOS and the browser (Navigation mode). - G2: Page size.
max(1, count − 1)fully visible data rows, measured at each keypress in the clipped visible area (Page size). - G3: Unlisted keys.
Space, printable characters,Delete,Backspace, andShift+arrows stay unhandled in navigation mode;EnterandF2are the keyboard paths into editing (Unhandled keys). - G4: In-cell controls. Display content and the single-line editor only; embedded widgets are deferred (Non-goals).
- G5: Header controls. Plain column headers; any sorting control sits outside the grid in page
Taborder (Non-goals, Semantics). - G6: Row headers. A
rowheaderbody cell takes part in roving focus (Semantics). - G7: Combined removal. Row first, then column, against the pre-update orders, applied once (Identity and recovery).
- G8: Empty to populated. Focus moves to the first body cell only when the empty grid still holds focus (Identity and recovery).
- G9: IME
Escape. A composingEscapebelongs to the IME; a later ordinaryEscapediscards the draft (Edit mode). - 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.
- 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). - 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).
- E3: Close, then emit, on
Enter. Focus returns to the cell beforeeditRequest, so an accepted reorder in the handler moves an already focused cell (Events). - E4: Changed means different text. Exact string inequality against the opening text; no trimming or parsing by the grid (Events).
- E5: Focus loss discards. Any focus move out of the editor other than
Enter,Escape, orTab/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). - E6: Rejection is app-controlled.
cellErrorsdrives visible text,aria-describedby,data-invalid, and one polite announcement; reopening starts from the current value (Acceptance and rejection). - E7: Draft invalidation. Insert and reorder keep the draft; removal, external value change, and becoming read-only discard it without emitting (Draft invalidation).
- E8: Editor is the only
Tabstop while editing. The cell leaves theTaborder andTabis not default-prevented (Semantics). - E9: No
requestIdineditRequest. The payload is exactly{ rowId, columnId, previousValue, draftText }; ordering concurrent saves is the application's, with a documented per-cell save queue (Async behavior). - E10:
Escapescope. Edit-modeEscapeis default-prevented so an enclosing dialog stays open; navigation-modeEscapeis 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:
requestIdineditRequest(E9). No. The payload stays{ rowId, columnId, previousValue, draftText }, and the application orders concurrent saves with the documented per-cell guard. A grid-mintedrequestIdcan be added later without breaking this payload.- 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.
- 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.