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

feat(MenuItem, MenuItem2): roleStructure="listitem" #5807

Merged

Conversation

bvandercar-vt
Copy link
Contributor

Fixes #0000

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

using roleStructure prop of MenuItem2, allow a configuration where the components have no assigned roles.

@adidahiya
Copy link
Contributor

@bvandercar-vt the code changes seem reasonable, but can you explain what kind of UI this would be useful in? Where are you rendering a MenuItem that is neither a "menuitem" or "listoption"?

@bvandercar-vt
Copy link
Contributor Author

bvandercar-vt commented Jan 3, 2023

@bvandercar-vt the code changes seem reasonable, but can you explain what kind of UI this would be useful in? Where are you rendering a MenuItem that is neither a "menuitem" or "listoption"?

We have a unique case where we are adding delete buttons to the MenuItem2s of a Select2, using Select2's itemRenderer prop. In this case, the 2 existing MenuItem2 aria role configurations (the roleStructure prop-- "listoption" and "menuitem") do not allow additional interactive elements to be within them-- this causes an aXe a11y failure.

So, in our case, we are manually changing the Select2 menu's role from listbox to list (using menuProps) , so that we can set its MenuItem2 items to just be plain no-role li's (using this PR), so that we can include buttons in each li without creating accessibility failures.

@adidahiya adidahiya changed the title refactor: allow no roles for menuitem, using roleStructure prop feat(MenuItem, MenuItem2): roleStructure="listoption" Jan 4, 2023
@adidahiya adidahiya changed the title feat(MenuItem, MenuItem2): roleStructure="listoption" feat(MenuItem, MenuItem2): roleStructure="listitem" Jan 4, 2023
@adidahiya adidahiya merged commit 0dec01e into palantir:develop Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants