fix(CUI-7441): Coral.CycleButton: fix menuitemradio and menuitem roles #153
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Per https://jira.corp.adobe.com/browse/CUI-7441
Description
In both the CoralUI and Coral Spectrum CycleButton implementations, the
menuitemradio
role oncoral-cyclebutton-item
and themenuitem
role oncoral-cyclebutton-action
are not propagated tocoral-selectlist-item
andbutton[is="coral-buttonlist-item"]
elements in the dropdown menu. Items within a menu should have amenuitem*
role.Behavior can be seen in Coral Spectrum:
coral-selectlist-item
elements in thecoral-selectlist[role="group"]
andbutton[is="coral-buttonlist-item"]
in thecoral-buttonlist
contained within thecoral-popover[role="menu"]
.Expected behavior
coral-selectlist-item elements should have role="menuitemradio"
button[is="coral-buttonlist-item"] elements should have role="menuitem"
Actual behavior
coral-selectlist-item
elements haverole="option"
, which is not appropriate for an item withinrole="menu"
.button[is="coral-buttonlist-item"]
elements have the implicit role ofbutton
, which is not appropriate for an item withinrole="menu"
.Suggested fix
At CycleButton.js#L653 and CycleButton.js#L668, where we are defining items for the SelectList and actions for the ButtonList, we seem to expect the role from the
coral-cyclebutton-item
orcoral-cyclebutton-action
to get applied to the SelectList.Item or ButtonList.Item, but these components do not include getters and setters for the role attribute, so the role is not applied. We should instead either explicitly set the role attribute or add a getter/setter for role to SelectList.Item and ButtonList.Item.Related Issue
https://jira.corp.adobe.com/browse/CUI-7441
Motivation and Context
Fixes accessibility implementation for items in the cycle button dropdown menu.
How Has This Been Tested?
Tested against documentation examples.
Types of changes
Checklist: