forked from microsoft/fluentui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow overriding ContextualMenu's internal List's role (microsoft#13908)
#### Pull request checklist - [X] Addresses an existing issue: Fixes microsoft#13971 - [X] Include a change request file using `$ yarn change` #### Description of changes Currently, the `ContextualMenu` control hard-code the `role` attribute of the internal List as `menu`. In my usage, I want to set a different role, specifically `grid`. There's currently no way to achieve this. In this PR, I'm adding a `role` property to the `IContextualMenuListProps` struct. The idea is that the consumer of `ContextualMenu` would provide a custom implementation of `onRenderMenuList` callback. Inside the callback, it can set the `role` attribute to `grid`, before invoking the default renderer. The default renderer inside `ContextualMenu` is modified to honor the `role` property. If `role` is not set, it falls back to `menu`, hence preserving the existing behavior. #### Focus areas to test Added unit tests.
- Loading branch information
1 parent
f58148f
commit e94ddb7
Showing
5 changed files
with
60 additions
and
11 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
change/office-ui-fabric-react-2020-07-02-14-53-01-contextual-menu-list-role.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "Allow consumer of ContextualMenu control to override the role of internal list.", | ||
"packageName": "office-ui-fabric-react", | ||
"email": "kinhln@microsoft.com", | ||
"dependentChangeType": "patch", | ||
"date": "2020-07-02T21:53:01.420Z" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters