Product requirements

M2 contract: the Grid surface

This file is the contract between the three M2 tracks: the Grid surface (@ember-lattice/ember), the theme (@ember-lattice/theme) and the harnesses (@ember-lattice/test-support).

Status
Shipped
Owner
Joe Gaudet
Created
Updated
One-pager
None
Related
None

Summary

Date: 2026-12-01. This file is the contract between the three M2 tracks: the Grid surface (@ember-lattice/ember), the theme (@ember-lattice/theme) and the harnesses (@ember-lattice/test-support). Each track builds against this file. To change the contract, change this file first and say so in the report.

Sources: plan sections 4.6 to 4.10, ADR 0002 (row recycling), ADR 0003 (scaled scroll), ADR 0004 (pinned columns and RTL).

Glossary

Not recorded in the original plan.

Problem and context

Not recorded in the original plan.

Goals and non-goals

Not recorded in the original plan.

Customers

Not recorded in the original plan.

Internal stakeholders

Not recorded in the original plan.

Users and scenarios

Not recorded in the original plan.

Landscape and constraints

Not recorded in the original plan.

Proposed design

5. Harnesses (@ember-lattice/test-support)

Built on harnessed (ComponentHarness, @ByRole). The grid harness finds the grid by its accessible name. Use GridHarness.named(env, label, scope, role). The role is 'grid' (default) or 'treegrid'.

class GridHarness extends ComponentHarness {
  rowCount(): Promise<number> // aria-rowcount minus the header rows and the total row
  columnCount(): Promise<number> // aria-colcount
  renderedRowIndexes(): Promise<number[]> // aria-rowindex of rendered body rows
  headers(): Query<HeaderCellHarness> // in visual order
  header(name: string): HeaderCellHarness // by its label text
  cell(rowIndex: number, column: string): CellHarness // rowIndex: 0-based data row
  activeCell(): Promise<{ rowIndex: number; column: string } | null>
  scrollToRow(rowIndex: number): Promise<void>
  press(key: string, modifiers?: Modifiers): Promise<void> // on the active cell
}
class HeaderCellHarness {
  text()
  sort(): Promise<'ascending' | 'descending' | 'none'>
  toggleSort()
  width()
  resizeBy(dx: number)
  isPinned(): Promise<'start' | 'end' | null>
}
class CellHarness {
  text()
  focus()
  isActive()
  isSelected()
  click()
  doubleClick()
}

The harness reads only the DOM in section 2 and the ARIA attributes. It never reads Lattice internals, so the same harness works under QUnit and Playwright.

7. Server row models (M4, 2026-12-01)

  • @rowModel (optional): a row model from @ember-lattice/data (infinite, cursor, server, viewport). Without it, the Grid uses the client model of the table.
  • Unloaded rows render as skeleton rows: aria-busy="true" on the row and data-loading on its cells. Rows of a failed block have data-failed.
  • aria-rowcount is -1 when the row count is not known (ARIA rule).
  • With server groups the Grid is role="treegrid". Group rows have aria-level and aria-expanded. The toggle is button.lt-group-toggle, and the label is span.lt-group-label. Enter on a group row toggles it.
  • The theme styles .lt-cell[data-loading], [data-failed] and the toggle chevron.
  • LatticeGrid.stateHost() returns a GridStateHandle (packages/ember/src/grid/state-host.ts). Give it to @stateHost and to persistGridState({ host }) (ADR 0011).
  • The harness finds role=grid and role=treegrid (see section 5).

8. Editing (M6, 2026-12-01)

ADR 0012 has the decisions. @ember-lattice/editing has the use.

  • @editing (optional): a GridEditing object, for example an EditController from @ember-lattice/editing. Without it, the Grid does not edit, paste, cut or fill.

  • The editor renders in .lt-overlay, outside role=grid:

    div.lt-overlay
      div.lt-editor  data-lt-edit-state=editing|validating|...   on the edited cell
        the control (the Formwright control; id = the editor ID; aria-label = the header)
        div.lt-editor-error  role=alert                              one for each error
    
  • Cells: with the engine cell selection, each body cell has aria-selected (true in a range, else false), and the grid has aria-multiselectable="true". A cell in a range has data-range-edge: a list of the range edges that the cell is on, from block-start, block-end, inline-start and inline-end, in that order. The theme draws the range borders from it. A cell with a staged value has data-dirty. The end corner cell of the last range has div.lt-fill-handle (aria-hidden="true") when @editing is given.

  • The edited row is held like the active row (data-held outside the range). The editor follows its cell when the grid scrolls. When the cell is out of the view, the editor gets data-lt-offscreen and a clip. The control keeps the focus, and the edit stays open.

  • Popup edit: a column with meta.lattice.editMode: 'popup' opens its editor under the cell, with data-lt-edit-mode="popup". Other editors have data-lt-edit-mode="cell". A popup editor has the cell width as its minimum width, so it can be larger than the cell. When it does not fit under the cell in the view, it opens over the cell. When it fits neither, it moves up into the view, over the cell.

  • Edit triggers (2026-12-02): @editTrigger is the pointer action that opens an editor: doubleClick (the default), singleClick or none. A column meta.lattice.editTrigger wins. A group row never opens an editor: a double click and Enter toggle it. Enter, F2 and a printable key open the editor with each trigger. A click with Shift, Ctrl, Meta or Alt, and a click on a button or a link in the cell, do not open an editor. A double click on a cell that opens no editor calls @onCellActivate. A press on a cell saves the open edit first; when that value is not valid, the edit stays open and no new editor opens.

  • The editor focus: the grid focuses the element with the editor ID. When that element cannot take the focus, the focus goes to its first :checked or [tabindex="0"] element, else to its first control.

  • The editor keys: a key that a control in the editor cancels (preventDefault) is not a grid key. Escape runs in the capture phase of .lt-overlay, so a control that stops the key in the bubble phase cannot keep the edit open; a layer that Escape closes (a list, a popover) cancels the key, and the edit stays open. Enter on a button in the editor (a calendar day) saves after the click of the button.

  • Save on focus out (2026-12-02): with @stopEditingWhenCellsLoseFocus, a cell edit (not a full-row edit) saves when the focus moves to an element outside .lt-overlay, or on a press outside .lt-grid-root. The focus stays where it went. Without it, the edit stays open; a press on a body cell still saves. Popups of the editor must stay in the DOM of the editor (the popover top layer does), or a press in them saves the edit.

  • Full-row edit: with an @editing that has mode: 'row' (new EditController({ rowEdit: true })), Enter or F2 opens div.lt-row-editor (role="group", aria-label="Edit row <n>") in the overlay. It has one field (.lt-row-editor-field) over each editable cell. Tab moves between the fields. Enter validates all fields and saves the changed values as one undo step. Escape cancels all fields. Errors show as role="alert" items, with the column name first.

  • Server rows: with @rowModel and a table that has the cell selection feature, the Grid owns one range (Shift+arrows, Ctrl+A). A copy takes the loaded rows of the range. A paste that reaches a row that is not loaded is refused as a whole, and the live region says "Paste refused: some rows are not loaded.".

  • Keys, added to section 3:

    Key Action
    Enter, F2, a printable key With @editing and a column editor: open the editor.
    Click, double click Open the editor, by @editTrigger (default: double click).
    Enter, Tab, Escape (editor) Commit and move down, commit and move to the inline end, or cancel.
    Shift+arrows Extend the last range (cell selection).
    Ctrl+A Select all cells (cell selection); else all rows. See the rule.
    Ctrl+C, Ctrl+X, Ctrl+V The copy, cut and paste events: TSV and HTML.
    Ctrl+Z, Ctrl+Shift+Z, Ctrl+Y Undo and redo (@editing).
  • Ctrl+A rule (2026-12-02): when the table has the cell selection feature, Ctrl+A selects all cells and no rows, also when the table has row selection. When the table has row selection only (and multi-select), Ctrl+A selects all rows.

  • The theme styles .lt-cell[aria-selected='true'] with --lt-range-bg and --lt-range-border, and styles .lt-editor, .lt-editor-error and .lt-fill-handle.

  • Harness: CellHarness.isInRange() (the cell aria-selected) and CellHarness.isDirty().

9. Extension points (M7, 2026-12-02)

ADR 0013 has the list of the hooks that @ember-lattice/ui needs. @ember-lattice/ember must not import @ember-lattice/ui, so each hook takes a component, a block or a plain object.

<LatticeGrid
  @table={{this.table}}
  @label='Orders'
  @density='compact'
  {{! compact | normal (default) | comfortable: data-lt-density on .lt-grid }}
  @find={{this.findModel}}
  {{! an object with matchAt(rowId, columnId): a FindModel }}
  @floatingFilter={{GridFloatingFilter}}
  {{! a component with Args { column }: adds the floating filter row }}
  @onCellContextMenu={{this.onMenu}}
  {{! called with { row, column, x, y, keyboard } }}
>
  <:sideBar><SideBar @table={{this.table}} /></:sideBar>
  <:contextMenu as |menu|><GridContextMenu @menu={{menu}} /></:contextMenu>
</LatticeGrid>
  • Density. @density sets data-lt-density on .lt-grid. The Grid reads the new row height when the attribute changes.
  • Header slot. A column with meta.lattice.header (a component with Args: { column, grid }) gets span.lt-header-slot in its leaf header cell, after the label. grid is a GridHeaderApi with autoSizeColumns(columnIds?). With no IDs, it sizes the columns that can resize. A floating filter gets the same args. A leaf header cell with a slot has aria-label with the label text, so its name does not include the names of the slot controls (ADR 0026). A click or a press in the slot does not sort and does not start a column drag. The controls in the slot must have tabindex="-1". F2 on the header cell moves the focus to the first control in the slot. Escape in the slot moves the focus back to the header cell (a menu or a dialog in the slot handles its own Escape).
  • Floating filter row. With @floatingFilter, the header has one more row, div.lt-row.lt-header-row.lt-floating-row, after the leaf header row. Its cells are div.lt-header-cell.lt-floating-cell role="gridcell", with aria-colindex, data-column-id and tabindex as in a body row, and each one holds the component. aria-rowcount and the aria-rowindex of the body rows count this row. The arrow keys move through it. Enter or F2 on a floating cell moves the focus to its control; Escape moves it back to the cell.
  • Find. With @find, each body cell has data-find-match="current|match" from matchAt(row.id, column.id), or no attribute.
  • Scroll to a cell. GridStateHandle.scrollToCell(rowId, columnId) makes the cell the active cell and scrolls it into view. The focus does not move. It returns false when the grid has not rendered, or when it has no such row (with a row model: no loaded row) or column. FindBar @grid={{handle}} calls it for the current match.
  • Live region. div.lt-live role="status" is in .lt-grid-root, outside role=grid, and is visually hidden. Its name is the locale text grid.messages. It has three parts: [data-live="message"] (a sort change, a refused paste), [data-live="edit"] (@editing.message: a save, a failed save, a paste result) and [data-live="count"] (the row count, for example "12 rows", after a filter).
  • Context menu. A right click on a body cell, Shift+F10 or the ContextMenu key (APG) makes the cell the active cell and opens a request. One key press opens one request: the contextmenu event that the browser sends after the key is ignored. The Grid calls @onCellContextMenu and renders the contextMenu block in .lt-overlay with { target, selection, close, copyText, pasteText } (GridContextMenuApi). copyText(withHeaders) gives the selection as TSV. pasteText(text) pastes through @editing. With no hook and no block, the browser menu opens.
  • Side bar. The sideBar block renders in div.lt-side-bar-region, after .lt-grid in .lt-grid-root, outside role=grid. With the block, the root is a flex row and the grid takes the free space, so the side bar is at the inline end.
  • Harness: CellHarness.findMatch() gives current, match or null. GridHarness.rowCount() does not count the floating filter row.

10. Row features (2026-12-02)

ADR 0018 has the decisions.

<LatticeGrid
  @table={{this.table}}
  @label='Orders'
  @rowHeight='auto'
  {{! a number, or 'auto': each row has the measured height of its content }}
  @isFullWidthRow={{this.isBanner}}
  @fullWidthRow={{Banner}}
  {{! a component with Args { row } }}
  @detailRow={{OrderLines}}
  {{! master/detail: a component with Args { row } }}
  @hasDetail={{this.hasLines}}
  @loading={{this.loading}}
  @onRowMove={{this.move}}
  {{! called with { row, fromIndex, toIndex } }}
  @onRowDrop={{this.receive}}
  {{! called with { row, source, toIndex } for a row from another grid }}
/>
  • One row list. All body rows are in .lt-body, in one index: the pinned top rows, the other rows (with an open detail row after its master row), then the pinned bottom rows. aria-rowcount counts all of them.

  • Client groups and tree data. A table with the engine expanding feature makes the grid role="treegrid". Each row has aria-level (depth + 1). A group row has aria-expanded, button.lt-group-toggle and span.lt-group-label (East (3)) in the first cell, as a server group (section 7), and the aggregates in the other cells. A tree row with sub rows has aria-expanded and the toggle before its value. Enter toggles a group or tree row.

  • Sticky rows. An open group or tree row that is a parent of a row in view has data-sticky. It stays under the header, one row height lower for each level, until the end of its group.

  • Pinned rows. A row of the engine row pinning has data-row-pinned="top|bottom". Top rows stay under the header and bottom rows stay at the end of the view. The scroller has the CSS variables --lt-view-top and --lt-view-bottom for these rows.

  • Row numbers. rowNumberColumn() is a column def. Its column is pinned at the start, and its cells show the 1-based display position.

  • Full-width and detail rows. div.lt-row (with .lt-detail-row for a detail row) has one div.lt-cell.lt-full-width-cell role="gridcell" aria-colindex="1" aria-colspan="<all>". The first cell of a master row has button.lt-group-toggle.lt-detail-toggle with aria-label="Details" and aria-expanded. A nested grid in a detail row has its own keys.

  • Measured rows. With @rowHeight="auto" or an open detail row, rows have data-index and an inline block-size: auto, and the grid measures them.

  • Row drag. A column with meta.lattice.rowDrag has span.lt-row-drag-handle (aria-hidden="true") in its cells. Alt+ArrowUp and Alt+ArrowDown move the row of the active cell. The live region says "Moved row 3 to row 4". While a drag runs, .lt-grid has data-row-dragging.

  • Cell spanning. With the engine cell spanning feature, a spanning cell has aria-rowspan or aria-colspan. A covered cell is not rendered. A row span leaves an aria-hidden spacer.

  • Overlays. div.lt-overlay-message role="status" is in .lt-grid-root, outside role=grid: "Loading…" while @loading (the grid then has aria-busy="true"), else "No rows" when the grid has no rows. Its name is the locale text grid.status.

  • Tooltips. A column meta.lattice.tooltip(value, row) gives div.lt-tooltip role="tooltip" in .lt-grid-root on hover or focus of a cell. The cell then has aria-describedby.

  • Touch. A touch press of 500 ms on a body cell opens the context menu (section 9).

  • Keys, added to section 3:

    Key Action
    Enter (group or tree row) Open or close the row.
    Alt+ArrowUp, Alt+ArrowDown With @onRowMove: move the row of the active cell.
    Escape Close the tooltip.

11. Column sizing, alignment, external filter, notes and hooks (2026-12-02)

ADR 0023 has the decisions.

<LatticeGrid
  @table={{this.table}}
  @label='Orders'
  @externalFilter={{this.passes}}
  {{! (row) => boolean: client rows that return false do not show }}
  @notes={{this.notes}}
  {{! an object with noteAt(rowId, columnId): the note text or undefined }}
  @aligned={{this.alignment}}
  {{! a GridAlignment from LatticeGrid.alignment(), given to two or more grids }}
  @locale='de-DE'
  {{! the locale of column type formats; default: the runtime locale }}
/>
  • Flex widths. A column def with flex gets a share of the free width of the scroller (core applyFlexWidths). The grid applies the shares after the first render, when the scroller width changes (ResizeObserver), and after a column resize. A resize of a flex column takes it out of flex: it keeps its new size, and the other flex columns share the rest.
  • Auto-size. A double click on .lt-resize-handle sizes its column to its widest rendered content: the header label and the rendered body cells (core autoSizeColumns). GridStateHandle.autoSizeColumns(columnIds?) sizes all columns, or the given columns. A column that is not rendered keeps its size.
  • Auto-generated columns. When the table has no leaf columns and has rows, the grid sets autoColumns(rows) on the table (table.setOptions), after the render. Rows that come later (the first data that is not empty) also get columns. autoColumns(rows, { types }) is also exported: it makes one column for each key of the first 10 rows. A key whose first value fits a type (type.isValue(value)) gets meta.columnType.
  • Column types. A column with meta.columnType (from @ember-lattice/column-types columnType()) shows type.format(value, @locale) in a cheap cell. meta.lattice.format wins.
  • Aligned grids. All grids with the same @aligned handle have the same horizontal scroll, and the same column sizes, order and visibility for the column IDs that they share. A change in one grid goes to the others.
  • External filter. With @externalFilter, the grid shows only the client rows (not the pinned rows) that pass. Tracked state that the function reads makes the grid filter again. aria-rowcount and the count in the live region count the rows that pass.
  • Notes. With @notes, a body cell that has a note has data-note. When a cell with a note is hovered or has the focus, div.lt-note role="note" shows its text in .lt-grid-root, outside role=grid, under the cell. When the tooltip of the cell is open too, the note is under the tooltip, so they do not overlap. The cell then has aria-describedby with the ID of the note (and of the tooltip, when it has one).
  • Header label slot. A column with meta.lattice.headerLabel (a component with Args: { column, label }) renders it in span.lt-header-label in place of the text. A click or a press on a control in it does not sort and does not start a column drag. F2 and Escape work as in the header slot (section 9).
  • Row header. The cells of the row number column (rowNumberColumn()) have role="rowheader", not gridcell.
  • Context menu. GridContextMenuApi.selection is the list of the current ranges, as GridRange (0-based display indexes). It has the grid range of @rowModel too, and the active cell when there is no range.
  • Row slot attribute. The recycle slot of a body row is data-lt-slot, not data-slot. Joinery and shadcn use data-slot as a component marker (research S13).

12. Grid hooks, round 2 (2026-12-02)

ADR 0026 has the decisions.

  • Cell description. meta.lattice.cellDescription(row, column) gives the accessible description of a cell, or undefined. The text is in a hidden div.lt-cell-descriptions in .lt-grid-root, outside role=grid, so it is not in the cell text. The cell aria-describedby has the ID of the description first, then the open tooltip and the open note. meta.lattice.cellInvalid(row, column) true gives the cell aria-invalid="true".

  • Start an edit. GridStateHandle.startEditing(rowId, columnId) opens the editor of the cell, as F2 does: the cell becomes the active cell, scrolls into view, and the editor gets the focus. It works with each editTrigger, also none. It gives false when the grid has not rendered, has no @editing, has no such loaded row or column, or cannot edit the cell.

  • First render. The column virtualizer starts with the size of the window and the center columns. So the first render has the headers in view, before the grid measures its scroller. The body rows come in the render after the measure.

  • Keys, added to section 3 (with @editing and the cell selection feature, not with @rowModel):

    Key Action
    Ctrl+D (Cmd+D) Fill down: the top row of the range fills the rows under it.
    Ctrl+R (Cmd+R) Fill right: the first column of the range fills the columns after it.

    In one row, Ctrl+D copies the row above. In one column, Ctrl+R copies the column at the inline start. The fill is the same edit as the fill handle (@editing.fill), one undo step. A row number cell is not a source and not a target. The fill handle stays aria-hidden: these keys are its keyboard path.

User interface and prior art

2. DOM

div.lt-grid-root                       no role; dir? (see the rules); holds the grid and the overlay
div.lt-grid  role=grid  aria-label  aria-rowcount  aria-colcount  aria-multiselectable?
             data-lt-density  data-lt-borders  data-lt-zebra?  dir?
  div.lt-scroller                     the one scroll container (ADR 0004); no tabindex: axe flags it in role=grid
    div.lt-sizer                      block-size = body rows only, no header (or the scaled size)
      div.lt-header  role=rowgroup    sticky, inset-block-start: 0
        div.lt-row.lt-header-row  role=row  aria-rowindex
          div.lt-header-cell  role=columnheader  aria-colindex  aria-sort?  data-column-id
                              data-pinned=start|end?  style="inline-size: <px>"
            span.lt-header-label
            div.lt-resize-handle  role=separator  aria-orientation=vertical
                                  aria-valuenow  aria-valuemin  aria-valuemax  aria-label
      div.lt-body  role=rowgroup
        div.lt-row  role=row  aria-rowindex  aria-selected?  data-row-id  data-lt-slot
                    data-held?  style="transform: translateY(<px>)"
          div.lt-spacer  aria-hidden=true     before the column range (inline-size)
          div.lt-cell  role=gridcell  aria-colindex  data-column-id  data-pinned?  tabindex=-1|0
          div.lt-spacer  aria-hidden=true     after the column range
      div.lt-footer  role=rowgroup        only with a grand total; sticky, inset-block-end: 0
        div.lt-row.lt-total-row  role=row  aria-rowindex   cells as in a body row
  div.lt-overlay  (sibling of div.lt-grid, inside div.lt-grid-root, outside role=grid; ADR 0002)

Rules:

  • dir: the Grid measures .lt-grid after the first render. It then sets dir on div.lt-grid-root to the computed direction of .lt-grid (ltr or rtl). .lt-grid has the dir that the app gives it. The root copies it, so the overlay has the same direction.
  • Grand total: with a row model that has totalRow, the Grid renders a third rowgroup, .lt-footer, after .lt-body. It has one .lt-total-row. It is sticky at the block end of the scroller. Column 1 shows "Total" when its column has no total value. aria-rowcount counts the total row, and its aria-rowindex is after the last data row.
  • Pivot columns: with a server row model that has a pivot, the result columns become leaf columns of the table, after its own columns. Each pivot key gives one header group, and each value gives one leaf. The leaf ID is the field of the result.
  • Body rows use translateY from the top of .lt-body, with no header offset.
  • The scroll range includes the sticky header. The Grid's virtualizer counts the header as paddingStart. The theme gives .lt-sizer min-block-size: max-content, so the real scroll height is header plus body. Above the cap, the scale ratio is (rows height + header - viewport) / (scrollHeight - viewport) (ADR 0003).
  • Row height: @rowHeight is optional. When it is given, the Grid sets --lt-row-height inline to the same value. When it is not given, the Grid reads the computed --lt-row-height, so the density presets work.
  • .lt-overlay is a 0×0 anchor at the inline start. It must not cover the grid, or axe checks no nodes.
  • aria-rowcount counts all rows, the header rows and the total row. aria-rowindex is 1-based and includes the header rows. aria-colcount and aria-colindex count all leaf columns, also the ones that are not rendered.
  • Header groups (from table.getHeaderGroups()) give one lt-header-row each. A group header cell has aria-colspan.
  • Pinned cells use position: sticky with inset-inline-start or inset-inline-end, set as an inline style with the sum of the earlier pinned widths.
  • Rows are as wide as all columns (inline-size on each row, ADR 0004 rule 1).
  • Held rows (the focused row, the edited row) render in the body with data-held and keep their aria-rowindex, also when they are outside the range.
  • One tab stop: the cell with tabindex=0 is the active cell. All other cells have tabindex=-1.

Decision (2026-12-01): .lt-overlay is outside role=grid. LatticeGrid renders div.lt-grid-root (no role). It holds div.lt-grid (role=grid) and div.lt-overlay as siblings. Editors and popovers render in the overlay (M6).

3. Keyboard (APG grid pattern)

Key Action
Arrow keys Move the active cell. In RTL, Left and Right swap.
Home / End First or last cell in the row.
Ctrl+Home / Ctrl+End First or last cell in the grid.
PageUp / PageDown Move by the number of rows in view.
Enter @onCellActivate; on a sortable header, toggle the sort.
Space On a row with selection: toggle the row selection.
Shift+Space Select the row (when selection is on).
Ctrl+A Select all rows (when multi-select is on).

The active cell scrolls into view. When the active row leaves the range, it is held (ADR 0002).

4. Theme

  • Classes are .lt-*, inside :where() for zero specificity, in @layer lattice. The app loads Joinery's tokens.css and a Joinery theme first.

  • Tokens, on .lt-grid, with Joinery tokens as defaults:

    Token Default
    --lt-row-height 32px (compact 28px, comfortable 40px)
    --lt-header-height var(--lt-row-height)
    --lt-cell-padding-inline 0.5rem
    --lt-font-size 0.875rem
    --lt-bg var(--background)
    --lt-fg var(--foreground)
    --lt-header-bg var(--muted)
    --lt-header-fg --muted-foreground mixed with 30% --foreground (4.5:1 contrast)
    --lt-border-color var(--border)
    --lt-row-hover-bg a mix of --muted and --background
    --lt-row-selected-bg a mix of --primary and --background
    --lt-zebra-bg a light mix of --muted
    --lt-focus-ring --ring mixed with 35% --foreground (3:1 contrast; --ring alone is 2.6:1)
    --lt-pinned-shadow a shadow on the inner edge of pinned columns
    --lt-range-bg, --lt-range-border for cell ranges (M6)
    --lt-resize-handle var(--primary)
  • Presets are data attributes on .lt-grid: data-lt-density="compact|normal|comfortable", data-lt-borders="none|rows|cells", data-lt-zebra, and data-lt-preset="sheet" (A1-style grid lines). list and board presets come in M3.

  • Light, dark (the Joinery .dark class; Joinery has no prefers-color-scheme rules) and forced-colors must all work. Text contrast is 4.5:1 or more in every preset.

Requirements

6. M2 feature list

  • Row virtualization (fixed height) and column virtualization, with scaled scroll above 10M px.
  • Hybrid row recycling, the held layer, the cell.state store (ADR 0002).
  • Header groups, sorting (click, Shift+click for multi-sort, aria-sort), column resize (pointer drag on the handle, and the keyboard on the separator), column reorder (pointer drag of a header), pinning (sticky), visibility, row selection (a checkbox column from Joinery Checkbox).
  • Keyboard and focus as in section 3.
  • Each render test ends with an axe audit.

Data model and API changes

1. Component API

<LatticeGrid
  @table={{this.table}}
  {{! a table from @ember-lattice/core constructTable }}
  @label='Orders'
  {{! required: the accessible name (aria-label) }}
  @rowHeight={{32}}
  {{! optional; else the computed --lt-row-height (section 2) }}
  @overscan={{4}}
  {{! rows outside the view on each side }}
  @getRowId={{this.rowId}}
  {{! optional; defaults to the table row id }}
  @onCellActivate={{this.open}}
  {{! optional: Enter or double click on a cell that does not open an editor }}
/>
  • LatticeGrid is the export name from @ember-lattice/ember.

  • The grid reads the table only. It writes state only through table APIs (column.toggleSorting, column.getToggleSortingHandler, table.setColumnSizing, table.setColumnOrder, row.toggleSelected). It never writes state during render.

  • Column options live in columnDef.meta.lattice (typed by a ColumnMeta augmentation in @ember-lattice/ember):

    Key Type Meaning
    cell component A full cell component. Signature: { Args: { cell, row, column, value, state } }.
    cellKind 'cheap' | 'full' 'cheap' cells reuse row slots. 'full' cells are keyed by row ID (ADR 0002). Default: 'full' when cell is set, else 'cheap'.
    format (value) => string The text of a cheap cell. Default: String(value ?? '').
    align 'start' | 'end' | 'center' Text alignment (logical).
  • state is the cell.state store: a tracked map keyed by row ID and column ID. A full cell keeps its own state there, so it stays correct when slots recycle.

Security and permissions

Not recorded in the original plan.

Observability and success metrics

Not recorded in the original plan.

Rollout and migration

Not recorded in the original plan.

Work items

Not recorded in the original plan.

Future work and research

Not recorded in the original plan.

Alternatives considered

Not recorded in the original plan.

Risks

Not recorded in the original plan.

Open questions

Not recorded in the original plan.

Interview record

Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.

QuestionAnswerSource
Where does the text of this page come from?From the Markdown file docs/m2-grid-contract.md at commit 4c77ac4. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so.Document: docs/m2-grid-contract.md

Changelog

DateAuthorChange
2026-12-03Joe GaudetCommit 7ce4af2: Lattice 1.0 (#1)
2026-12-04Joe Gaudet (agent)Converted from docs/m2-grid-contract.md to this page. The text is the text of the Markdown file.
2026-12-04Joe Gaudet (agent)Status Shipped: the Grid surface of this contract is in version 1.0.0 of @ember-lattice/ember on npm (tag v1.0.0).

The prd skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.