Skip to content

feat(rune-kit): Table::virtual_columns and Table::frozen_columns for wide tables (part of #997) - #2238

Merged
Hona merged 1 commit into
devfrom
feat/997-table-virtual-columns
Nov 25, 2026
Merged

Hona merged 1 commit into
devfrom
feat/997-table-virtual-columns

Conversation

@Hona

@Hona Hona commented Nov 25, 2026

Copy link
Copy Markdown
Member

Refs #997

Adds opt-in horizontal column windowing and pinned leading columns to rune_kit::Table, ARIA grid coordinates on AccessKit and the web DOM mirror, and zero-view-run vertical virtual_rows remounts inside scroll_xy wrappers.

API

Table::new(|s: &App| &s.table, |s: &mut App| &mut s.table, |s: &App| s.rows.len(), |s: &App, i| s.rows[i].id.as_str().into())
    .scroll_wide(true)
    .virtual_columns(true) // default: false
    .frozen_columns(2)     // default: 0
    .column(TableColumn::new("id", "ID").width(80.0))
    .cell(|s: &App, i, col| Cell::text(s.cell(i, col)))
    .build(s, &kit)

What changed

  • crates/rune-kit/src/containers/table/{window,render,view,order}.rs and table.rs:
    • Added Table::virtual_columns(bool) (default false) and Table::frozen_columns(usize) (default 0), strictly additive with zero behaviour or accessibility tree changes when left off.
    • When scroll_wide(true) overflows the viewport, ColumnPlan computes exact column prefix offsets, mounts 0..frozen with El::sticky_left(col_x) and opaque row/header fills (composing with the header's sticky_top(0.0) and drawing a stuck right divider), windows non-frozen columns to [scroll_x - overscan, scroll_x + view_w + overscan], and emits a11y_hidden fixed-width spacers so total scroll width and every mounted column's x-position match a non-virtualised table.
    • Horizontal scroll offsets are observed via content's on_layout_tx with an edge hysteresis band (Tx::live_only() while inside the band, so vertical scrolls and small sideways scrolls trigger zero view runs; crossing the band commits one view pass to shift the column window).
    • Non-frozen columns actively being resized, reordered, or holding keyboard focus / El::caret_browsing(true) stay pinned at their exact x-offset when scrolled out of view and unmount cleanly on blur/release.
    • When either builder is enabled, emits El::row_count, El::column_count, El::row_index, and El::column_index on grid, row, columnheader, and gridcell nodes.
  • crates/rune/src/runtime/commit/remount.rs: relaxed CommitState::virtual_only from !n.scroll_axes.x() to n.scroll_axes.y() && (!n.scroll_axes.x() || tree.nodes[list_idx].parent != Some(scroll_idx)) so vertical virtual_rows nested inside a fixed-width wrapper under scroll_xy takes CommitKind::Remount with zero view runs.
  • crates/rune/src/runtime/web/a11y.rs, patch.rs, crates/rune/src/platform/web/bridge.js: mirrored aria-rowcount, aria-colcount, aria-rowindex, and aria-colindex into the web DOM mirror and focus proxy.
  • examples/kit-gallery/src/stories/table.rs & stories.rs: added rune-table--virtual-columns (10,000 × 200 sheet with toggles for virtual and frozen columns), plus docs in crates/rune-kit/README.md and changelog/unreleased/2026-11-25-table-virtual-columns.md.

Outside answers followed

  • ARIA windowed grids: WAI-ARIA 1.2 aria-rowcount, aria-colcount, aria-rowindex, aria-colindex for partially mounted grids (leaving non-windowed defaults unchanged).
  • Pinned leading columns: AG Grid pinned-left columns composed via CSS position: sticky (El::sticky_left + El::sticky_top).

Benchmark (--profile perf, 5 paired alternating runs, headless)

10,000 rows × 200 columns (100 pt each), 1,000 × 1,150 pt viewport (~40 visible rows; 42 mounted rows with virtual_overscan(0.0, 0.0)). Headless CPU measurements exclude GPU upload and presentation.

Metric virtual_columns(false), frozen_columns(0) virtual_columns(true), frozen_columns(2)
Mounted columns (start / mid-scroll) 200 15 / ~20
Cells built & mounted (gridcell) 8,400 630
Full commit + layout rebuild (median, min–max) 55.76 ms (51.06–56.92 ms) 4.67 ms (3.72–5.64 ms)
Vertical scroll remount (median, view runs) 36.59 ms (0 view runs) 2.37 ms (0 view runs)
Horizontal scroll across window boundaries 0 view runs (all 200 mounted) 12.68 ms median per window shift (1 view run per ~360 pt; 0 view runs within hysteresis band)

What remains on #997

Not seen on a real device

  • Live desktop window visual inspection, real screen reader announcements, non-Chromium web browsers, and iOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant