Build an accessible virtualized data grid: sticky header, sorting, column resizing and keyboard cell navigation
Problem
Admin panels, trading screens and spreadsheets all need a table with thousands of rows that stays fast, can be sorted and resized, and works with a keyboard and a screen reader. Each feature is simple alone; together they fight. Virtualization removes rows from the DOM, but keyboard focus needs them there. A sticky header changes which rows count as visible. Resize handles live inside header cells that also sort on click. Build the grid.
rowsare objects with a uniqueid.columnsare{ key, header, width?, sortable?, minWidth?, maxWidth? }(defaults: width 120, minWidth 40, maxWidth 600). Each cell showsString(row[column.key]).
Ref. UR-1439 · © UIRound · uiround.com/questions/build-an-accessible-virtualized-data-grid-sticky-header-sorting-column-resizing-and-keyboard-cell-navigation
Unlock this question
The full problem, its tests and the tested solution are part of Pro.
- 2
- code listings
- 6
- edge cases
- 5
- follow-up questions
What's inside
- The full problem, with examples
- Tests that check your solution
- Step-by-step
- Approach
- Solution
- Complexity
- Edge cases
- Follow-up questions
- Card worldwide
- UPI and net banking in India
- One-time payment, nothing renews
Stuck? Take a hint
- 1Start from the numbers: with a fixed row height, which row indexes are visible for a given
scrollTop, and where is each one positioned? Remember the sticky header covers the top of the viewport.
Try it in the editor
Run your code as often as you like. Submitting it to the full test suite is part of Pro.
Private, and saved in this browser as you type. All your notes are on My lists.