-
Notifications
You must be signed in to change notification settings - Fork 842
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
[EuiKeyPadMenuItem] Moves beta badge tooltip props to a wrapping EuiToolTip #5541
Conversation
…aps the keypad menu item only if necessary
Preview documentation changes for this PR: https://eui.elastic.co/pr_5541/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a much improved solution over the exploration I was doing. This reorganizes the beta badge as a visual cue that doesn't diminish the experience for keyboard navigation or screen reader use. This solution also passes the axe browser check for not having nested focusable elements.
Preview documentation changes for this PR: https://eui.elastic.co/pr_5541/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM! Thank you for adding the aria-hidden
attribute to the beta badge.
Preview documentation changes for this PR: https://eui.elastic.co/pr_5541/ |
Fixes #5290 based on explorations in #5508
@1Copenut, I was reviewing your latest changes in #5508, and had a thought about this whole ordeal. I wanted to go back to the original though around why we needed/wanted "Beta badges". Essentially they give further description to the button by providing a small visual indicator with fulll description through a tooltip.
The original implementation relied solely on the EuiBetaBadge's own tooltip to provide that functionality. This was a mistake. Not just for screen-reader accessibility but also for touch points and discoverability. Essentially only allowing a small 24x24 area to be the trigger for this tooltip, even though it's giving more context to the whole button.
Also no matter what we did to correctly pull out this badge from the button and hook up the descriptions through aria- props, we ended up with a disjointed UI. Meaning, each button had two tabs to get to the next, and once the user's focus is on the beta badge, the context of the button's label is lost.
So... going back to the intent of the beta badge, is to show a (1.) visual indicator and (2.) tooltip with more information.
Since we ask for the beta badge props individually, we can pull out the specific tooltip ones and pass that to a wrapping EuiTooltip instead. Thus removes any interactivity from the beta badge itself, just becoming something purely visual (1.) and puts the tooltip on the already interactive element that the key pad menu renders (2.).
This is what renders:
🔔 Breaking
The breaking change here would only be that, when a beta badge exists, consumers who need to customize the outer element need to use the new
betaBadgeTooltipProps
to pass a customanchorClassName
too. This is more based on how EuiToolTip works which wraps the child in this anchor element.Checklist
[ ] Added documentation[ ] Checked Code Sandbox works for any docs examples