Skip to content

Commit

Permalink
GroupedList: Add ability to pass role to groupProps (microsoft#11791)
Browse files Browse the repository at this point in the history
#### Pull request checklist

- [ ] Addresses an existing issue: Fixes #0000
- [x] Include a change request file using `$ yarn change`

#### Description of changes

Add ability to pass `role` to `groupProps` for GroupedList to override the default role of `grid` for grouped list sections. Role `grid` remains the default with this change.

#### Focus areas to test

(optional)
  • Loading branch information
erichdev authored and msft-github-bot committed Jan 25, 2020
1 parent 58160d2 commit 9e7b657
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 1,8 @@
{
"type": "minor",
"comment": "GroupedList: Add role prop to groupProps",
"packageName": "office-ui-fabric-react",
"email": "[email protected]",
"commit": "c457462537a257458d2df6571f70e743974036e2",
"date": "2020-01-24T18:54:34.656Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4914,6 4914,7 @@ export interface IGroupRenderProps {
onRenderHeader?: IRenderFunction<IGroupHeaderProps>;
onRenderShowAll?: IRenderFunction<IGroupShowAllProps>;
onToggleCollapseAll?: (isAllCollapsed: boolean) => void;
role?: string;
showAllProps?: IGroupShowAllProps;
showEmptyGroups?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 239,11 @@ export interface IGroupRenderProps {
* @defaultvalue false
*/
showEmptyGroups?: boolean;

/**
* Override which allows the caller to provide a custom aria role
*/
role?: string;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 308,13 @@ export class GroupedListSection extends React.Component<IGroupedListSectionProps
}

private _onRenderGroup(renderCount: number): JSX.Element {
const { group, items, onRenderCell, listProps, groupNestingDepth, onShouldVirtualize } = this.props;
const { group, items, onRenderCell, listProps, groupNestingDepth, onShouldVirtualize, groupProps } = this.props;
const count = group && !group.isShowingAll ? group.count : items.length;
const startIndex = group ? group.startIndex : 0;

return (
<List
role="grid"
role={groupProps && groupProps.role ? groupProps.role : 'grid'}
items={items}
onRenderCell={this._onRenderGroupCell(onRenderCell, groupNestingDepth)}
ref={this._list}
Expand Down

0 comments on commit 9e7b657

Please sign in to comment.