Skip to content

Commit

Permalink
Add containerRole and aria-readonly props
Browse files Browse the repository at this point in the history
  • Loading branch information
smockle committed Jul 17, 2017
1 parent 9ddd237 commit c36da4b
Showing 1 changed file with 11 additions and 0 deletions.
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

0 comments on commit c36da4b

Please sign in to comment.