Skip to content

Adds range rendering#218

Closed
thielium wants to merge 1 commit intobvaughn:masterfrom
thielium:cell-range
Closed

Adds range rendering#218
thielium wants to merge 1 commit intobvaughn:masterfrom
thielium:cell-range

Conversation

@thielium
Copy link
Copy Markdown

In certain situations, consumers benefit from being able to control how virtualized items are placed, such as when managing aria attributes (where the DOM hierarchy determines accessibility; see
https://www.w3.org/TR/wai-aria-1.1/#grid).

In this pull request, one could fulfill the accessibility requirement with a cellRangeRenderer function, such as the example below:

  const accessibleCellRangeRenderer = ({
    rowStartIndex,
    rowStopIndex,
    columnStartIndex,
    columnStopIndex,
    childFactory,
  }) => {
    const rows = [];
    for (let rowIndex = rowStartIndex; rowIndex <= rowStopIndex; rowIndex++) {
      const rowChildren = [];
      for (
        let columnIndex = columnStartIndex;
        columnIndex <= columnStopIndex;
        columnIndex++
      ) {
        const cell = childFactory({ rowIndex, columnIndex });
        rowChildren.push(cell);
      }
      rows.push(<div role="row">{rowChildren}</div>);
    }

    return rows;
  };

Should address #217

In certain situations, consumers benefit from being able to control how
virtualized items are placed, such as when managing aria attributes
(where the DOM hierarchy determines accessibility; see
https://www.w3.org/TR/wai-aria-1.1/#grid).

This commit adds some light tooling to allow consumers to specify
exactly how children are placed in the DOM hierarchy.
@bvaughn
Copy link
Copy Markdown
Owner

bvaughn commented May 28, 2019

This code change seems solid.

I need to think on it more before I am willing to commit to merging it though. Getting rid of the range renderer prop felt like a nice change from react-virtualized to react-window. Re-adding it would add extra function calls to relatively hot code.

@thielium
Copy link
Copy Markdown
Author

Closing -- no time to work on this, and the iron's no longer hot.

@thielium thielium closed this Jan 28, 2021
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.

2 participants