Skip to content

ContextualMenu - Added support for custom component lengths and fixed aria-posinset value#4004

Merged
jspurlin merged 7 commits intomicrosoft:masterfrom
chang47:menusize
Feb 21, 2018
Merged

ContextualMenu - Added support for custom component lengths and fixed aria-posinset value#4004
jspurlin merged 7 commits intomicrosoft:masterfrom
chang47:menusize

Conversation

@chang47
Copy link
Copy Markdown
Contributor

@chang47 chang47 commented Feb 16, 2018

Problem:
In the Contextual Menu if we have to rely on the custom onRender() of a passed in ContextualItem we would pass in the index of our element so that the user can use it for aria-posinset for accessibility reasons.

However, in the event that the contextual item is a list and has items in it. The contextual menu would have no way of knowing.

Also, posinset starts at index 1 and not 0. We currently pass in our index starting at the value of 0, so I'm also doing a side fix for that for the custom onRender()

Solution:
To help detect that we might have a custom component that has their own list of items, I introduced a new prop that allows the users to add in the length of their component that we'll consider when calculating the index and total set size of the elements in our list.

I also added 1 to the value that we're sending out to help adjust for the fact that aria-posinset is 1-based index and not 0 based-index.

Validation:
I tested the changes locally by using my changes with my own custom component with a list and validated that the numbers are all correct.

@chang47 chang47 requested a review from joschect as a code owner February 16, 2018 18:37
@chang47 chang47 changed the title Contextual Menu - Pass in correct aria-posinset value for custom rendering Contextual Menu - Added support for custom component lengths and fixed aria-posinset value Feb 17, 2018
@dzearing dzearing changed the title Contextual Menu - Added support for custom component lengths and fixed aria-posinset value ContextualMenu - Added support for custom component lengths and fixed aria-posinset value Feb 18, 2018
@jspurlin jspurlin merged commit 8f5fe3b into microsoft:master Feb 21, 2018
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants