Skip to content

Conversation

bvaughn
Copy link
Owner

@bvaughn bvaughn commented Sep 4, 2025

Version 2.1 release

Improve accessibility through better default ARIA attributes and documentation

The primary goal of this commit is to improve ARIA support.

  • Add better default ARIA attributes
    • Add ariaAttributes prop to row and cell renderers to simplify integration
    • Add recommended best-practices examples to docs
  • Remove intermediate HTMLDivElement from List and Grid
    • This may enable more/better custom CSS styling
    • This may also enable adding an optional children prop to List and Grid for e.g. overlays/tooltips
// Example of how to use new `ariaAttributes` prop
function RowComponent({
  ariaAttributes,
  index,
  style,
  ...rest
}: RowComponentProps<object>) {
  return (
    <div style={style} {...ariaAttributes}>
      ...
    </div>
  );
}

A secondary goal that may shake out of this is the ability to open up a bit more space for customization with two new optional props:

  • tagName: Defaults to "div" but can be changed to render e.g. <ul>
  • children: Can be used to add custom overlays, tooltips, etc. within the list/grid element

Resolves #834

Minor changes to onRowsRendered and onCellsRendered callbacks

These methods will now receive two params– the first for visible rows and the second for all rows (including overscan), e.g.:

function onRowsRendered(
  visibleRows: {
    startIndex: number;
    stopIndex: number;
  },
  allRows: {
    startIndex: number;
    stopIndex: number;
  }
): void {
  // ...
}

function onCellsRendered(
  visibleCells: {
    columnStartIndex: number;
    columnStopIndex: number;
    rowStartIndex: number;
    rowStopIndex: number;
  },
  allCells: {
    columnStartIndex: number;
    columnStopIndex: number;
    rowStartIndex: number;
    rowStopIndex: number;
  }
): void {
  // ...
}

Resolves #837

Copy link

vercel bot commented Sep 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
react-window Ready Ready Preview Sep 6, 2025 6:22pm

@bvaughn bvaughn changed the title Improve accessibility through better default ARIA attributes and documentation Version 2.1.0 Sep 6, 2025
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.

[V2] Grid onCellsRendered function index params are not visible[Row/Column][Start/Stop]Index Fix accessibility

1 participant