Choose virtualization with accessibility checks
Measure before choosing virtualization
Virtualization renders only a window near the scroll position, rather than one DOM node per record. It reduces mounted UI, not the size of the dataset or the cost of all filtering. For 1,000 equipment names, a viewport showing four fixed-height rows can mount a small range plus overscan (extra rows near the viewport). Pagination is often easier to navigate and should be considered first. A headless table library owns row logic; a virtualizer owns visibility and geometry. Neither automatically makes an interface accessible.
export function makeRows(count=1000){ if(!Number.isSafeInteger(count)||count<0||count>10000) throw new RangeError('Invalid count'); return Array.from({length:count},(_,i)=>({id:`item-${i+1}`,name:`Equipment ${i+1}`}));}export function windowRange(count, scrollTop, height, rowHeight, overscan=2){ if(![count,overscan].every(n=>Number.isSafeInteger(n)&&n>=0)|| ![scrollTop,height,rowHeight].every(Number.isFinite)||scrollTop<0||height<=0||rowHeight<=0) throw new RangeError('Invalid geometry'); const top=Math.min(scrollTop,Math.max(0,count*rowHeight-height)); const start=Math.max(0,Math.floor(top/rowHeight)-overscan); const end=Math.min(count,Math.ceil((top+height)/rowHeight)+overscan); return {start,end,totalHeight:count*rowHeight};}For 1,000 rows, 40px per row, a 160px viewport and scrollTop 200, the range is [3,11): eight rows with two extra at each side. The total simulated height is 40,000px. At the end, clamp scrollTop so the window cannot point beyond the data. The helper is deliberately fixed-height and does not model variable measurement, resize, horizontal virtualization or scroll anchoring.
A visual-only fixed-height preview
import React,{useState} from 'react';import {windowRange} from './window.mjs';export default function VisualWindow({rows}:{rows:{id:string,name:string}[]}){ const [top,setTop]=useState(0); const range=windowRange(rows.length,top,160,40); return <div aria-hidden="true" style={{height:160,overflowY:'auto'}} onScroll={e=>setTop(e.currentTarget.scrollTop)}> <div style={{height:range.totalHeight,position:'relative'}}>{rows.slice(range.start,range.end).map((r,i)=><div key={r.id} style={{position:'absolute',top:(range.start+i)*40,height:40,whiteSpace:'nowrap',overflow:'hidden'}}>{r.name}</div>)}</div> </div>;}The inner spacer keeps the full scroll extent, while positioned children match record offsets. This restricted preview is hidden from the accessibility tree and contains no interactive descendants. It is not the primary interface. Fixed heights may clip large text; a complete paginated alternative is always provided below. Do not hide a sole data view or focusable controls with aria-hidden. A production interactive virtual list must preserve focused items, restore focus after filtering, support appropriate keyboard navigation and communicate item positions where applicable. Test at browser zoom and with actual assistive technology.
Provide the full dataset through native pagination
import React,{useState} from 'react';import VisualWindow from './VisualWindow';import {makeRows} from './window.mjs';const rows=makeRows(1000), size=20;export default function EquipmentViews(){ const [page,setPage]=useState(0),[preview,setPreview]=useState(false); return <section><h2>Equipment directory</h2><button onClick={()=>setPreview(v=>!v)}>{preview?'Hide':'Show'} optional visual preview</button> {preview&&<VisualWindow rows={rows}/>} <p role="status">Page {page+1} of {Math.ceil(rows.length/size)}</p> <ul>{rows.slice(page*size,(page+1)*size).map(r=><li key={r.id}>{r.name}</li>)}</ul> <button disabled={page===0} onClick={()=>setPage(p=>p-1)}>Previous</button><button disabled={(page+1)*size>=rows.length} onClick={()=>setPage(p=>p+1)}>Next</button> </section>;}All 1,000 entries are reachable with 50 pages of 20, even if the visual preview is disabled. Page changes announce the current page; controls remain native buttons. TanStack Virtual v3 exposes estimateSize, overscan, getItemKey and measurement options; use measured sizes for variable-height content and stable keys. Combine it with a table row model only after agreeing which logical rows are visible. A library does not remove the need for an accessible fallback and real user tests. For this fixture, compare rendered counts and navigation paths; do not claim a speedup without measurements. Practice: derive the range near the last row, then test all pages through the alternative view.