Pinned columns, column virtualization, RTL and sticky group rows (spike S4)
Use one scroll container.
Context
- Spike: S4 in
docs/plan.md, section 11 - Spike code:
test-app/app/spikes/s4/pinned-grid.gts - Tests:
test-app/tests/spikes/s4-pinned-columns-test.gts
A grid must keep pinned columns at the edges while the middle columns scroll and are
virtualized. The grid must also work in right-to-left (RTL) languages, and a group row must
stay at the top during vertical scroll. The plan of record is one scroll container with
position: sticky, as AG Grid v36 does. CSS logical properties make RTL work with no extra
code. The fallback is separate pinned containers with synced scroll.
The spike grid has 2 columns pinned to the inline start, 40 middle columns and 1 column pinned to the inline end. Each column is 100 px wide. The viewport is 600 px by 300 px. The grid has a sticky header row, one sticky group row and 100 data rows.
Decision drivers
Not recorded in the original ADR.
Options considered
Not recorded in the original ADR.
Decision
- Use one scroll container. Each row is a flex row as wide as all columns (4,300 px). The width must be explicit, or the inline-end sticky cell cannot move to the edge.
- Pinned cells use
position: stickywithinset-inline-start(the sum of the earlier pinned widths) orinset-inline-end. The header row usesinset-block-start: 0. The group row usesinset-block-start: var(--lt-row-height). - RTL needs no code in the layout.
dir="rtl"on the container reverses the flex rows and the logical insets. The only RTL code is in the range:scrollLeftis 0 at the inline start and negative toward the inline end, so the range usesMath.abs(scrollLeft). - Column virtualization renders only the middle columns in view, plus an overscan of 1. Two spacer elements, before and after the range, keep the row width. The spacers have no role.
- A label in a sticky group row must be in a cell as wide as the row. Sticky does not move an element outside its containing block.
- Do not build the fallback (separate pinned containers with synced scroll). No sticky case failed in the spike.
Consequences
- The DOM order of cells is the visual order in both directions: start-pinned cells, the
middle range, then end-pinned cells.
aria-colindexgives screen readers the true index. - Pinned cells need an opaque background (
Canvasin the spike) and a stacking order above the middle cells.--lt-pinned-shadowmarks the pinned edge. - The spike does not virtualize rows. Row virtualization (spike S2) and column virtualization must work together in the real renderer.
- The checks ran in headless Chrome 158 only. A real check in Firefox and Safari must cover:
the sign of
scrollLeftin RTL, sticky cells in a scaled ancestor, and the side of the vertical scrollbar in RTL. The spike scroller usesscrollbar-width: none, so the tests do not measure the scrollbar side.
Confirmation
Evidence
All tests pass in headless Chrome 158. Each test ends with an axe audit.
| Test | LTR | RTL |
|---|---|---|
| pinned cells stay at the inline-start and inline-end edges after a horizontal scroll | passes | passes |
| middle columns outside the range are not in the DOM | passes | passes |
| the sticky group row stays at the top during vertical scroll | passes | passes |
| ARIA: role, counts and indexes on the rendered rows and cells | passes | passes |
- The edge test scrolls 1,500 px toward the inline end (
scrollLeftis 1500 in LTR and -1500 in RTL). It compares thegetBoundingClientRectedges of the cells in the header row and in a data row with the scroller edges, to less than 1 px. - The range test checks that column 3 (the first middle column) is removed after the scroll, that column 18 is in the DOM, and that a data row has fewer than 15 cells (8 in practice).
- The sticky test scrolls 1,500 px down and 800 px across. The header row stays at the top, the group row stays under it, and the group label stays at the inline start.
- The ARIA test checks
role="grid",aria-rowcount="102",aria-colcount="43", onearia-rowindexfor each row in DOM order, andaria-colindexvalues in order: 1, 2, a contiguous middle range, then 43. - The test container of
ember-qunitis scaled to 50%. The geometry checks compare rects with rects only, never withclientWidthorscrollLeft. - The first run of the sticky test failed: the group label did not move. Its cell was only as wide as the label. Decision 5 fixed this.
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.
| Question | Answer | Source |
|---|---|---|
| Where does the text of this page come from? | From the Markdown file docs/adr/0004-pinned-columns-rtl.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/adr/0004-pinned-columns-rtl.md |
Changelog
| Date | Author | Change |
|---|---|---|
| 2026-12-01 | Joe Gaudet | Status in the Markdown file: Accepted for Chrome. Firefox and Safari need a check (see "Consequences"). |
| 2026-12-03 | Joe Gaudet | Commit 7ce4af2: Lattice 1.0 (#1) |
| 2026-12-04 | Joe Gaudet (agent) | Converted from docs/adr/0004-pinned-columns-rtl.md to this page. The text is the text of the Markdown file. |
The adr skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.