Remove role="menubar/menuitem"
from the container and siblings of selected card actions
#3950
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.
Changelog Entry
Fixed
role="menubar"
) must have at least 1 or morerole="menuitem"
, by @compulim, in PR #3950Description
After clicked/performed a card action, for accessibility reasons, we did some manipulations:
aria-pressed="true"
to indicate the button selectedrole="button"
fromrole="menuitem"
, to fulfill the requirement foraria-pressed
Visually, it means:
Would become:
When the container only has 1 action, unfortunately, the container will be left with no descendants of
role="menuitem"
, because we changed it torole="button"
.Design
In this fix, we are going to:
role="menubar"
from the container;role
attribute from all non-selected card action, which wasrole="menuitem"
.Visually, it means:
Would become:
Since a single Adaptive Card could contains multiple
ActionSet
containers and one set of card actions, we are only touching those containers which selection has been made. And leave others untouched.When we are working on this fix, we also discovered
adaptivecards@2.9.0
is generating a DOM tree for "card action" which looks like:(This bug only applies to "card actions", but not "action set" containers.)
Note there are no
menuitem
roles under themenubar
role. This is violating the WCAG rule and is filed as #3949.Before waiting for a fix from Adaptive Cards team, we are hacking the DOM to change buttons' role to
menuitem
.We believe this change is reasonable because:
role="menuitem"
to elements insideActionSet
ActionSet
container is a special container for action buttons, multiple sets are allowed, can be put anywhere in the card including frontrole="button"
to elements inside card actions. But 2.5.0 was applyingrole="menuitem"
.Specific Changes
AdaptiveCardRenderer
role="menubar"
from the containerrole
attribute from all sibling actions that are not selectedfixAccessibilityIssuesWithUndo
:button
roles undermenubar
roles will becomemenuitem
roles insteadCHANGELOG.md
I have updated documentationReview Checklist
Accessibility reviewed (tab order, content readability, alt text, color contrast)Browser and platform compatibilities reviewedCSS styles reviewed (minimal rules, noz-index
)Documents reviewed (docs, samples, live demo)Internationalization reviewed (strings, unit formatting)package.json
andpackage-lock.json
reviewedSecurity reviewed (no data URIs, check for nonce leak)