Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid: Improve accessibility by adding props aria-readonly & role="rowgroup" #744

Merged
merged 1 commit into from
Jul 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions source/Grid/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const SCROLL_POSITION_CHANGE_REASONS = {
export default class Grid extends PureComponent {
static propTypes = {
"aria-label": PropTypes.string,
"aria-readonly": PropTypes.bool,

/**
* Set the width of the inner scrollable container to 'auto'.
Expand Down Expand Up @@ -95,6 +96,11 @@ export default class Grid extends PureComponent {
columnWidth: PropTypes.oneOfType([PropTypes.number, PropTypes.func])
.isRequired,

/**
* ARIA role for the cell-container.
*/
containerRole: PropTypes.string,

/** Optional inline style applied to inner cell-container */
containerStyle: PropTypes.object,

Expand Down Expand Up @@ -245,7 +251,9 @@ export default class Grid extends PureComponent {

static defaultProps = {
"aria-label": "grid",
"aria-readonly": true,
cellRangeRenderer: defaultCellRangeRenderer,
containerRole: "rowgroup",
estimatedColumnSize: 100,
estimatedRowSize: 30,
getScrollbarSize: scrollbarSize,
Expand Down Expand Up @@ -836,6 +844,7 @@ export default class Grid extends PureComponent {
autoHeight,
autoWidth,
className,
containerRole,
containerStyle,
height,
id,
Expand Down Expand Up @@ -897,6 +906,7 @@ export default class Grid extends PureComponent {
<div
ref={this._setScrollingContainerRef}
aria-label={this.props["aria-label"]}
aria-readonly={this.props["aria-readonly"]}
className={cn("ReactVirtualized__Grid", className)}
id={id}
onScroll={this._onScroll}
Expand All @@ -910,6 +920,7 @@ export default class Grid extends PureComponent {
{childrenToDisplay.length > 0 &&
<div
className="ReactVirtualized__Grid__innerScrollContainer"
role={containerRole}
style={{
width: autoContainerWidth ? "auto" : totalColumnsWidth,
height: totalRowsHeight,
Expand Down