[EuiKeyPadMenuItem] Moves beta badge tooltip props to a wrapping EuiToolTip#5541
Merged
cchaos merged 5 commits intoelastic:mainfrom Jan 18, 2022
Merged
[EuiKeyPadMenuItem] Moves beta badge tooltip props to a wrapping EuiToolTip#5541cchaos merged 5 commits intoelastic:mainfrom
cchaos merged 5 commits intoelastic:mainfrom
Conversation
added 2 commits
January 14, 2022 15:46
…aps the keypad menu item only if necessary
10 tasks
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5541/ |
1Copenut
suggested changes
Jan 14, 2022
Contributor
1Copenut
left a comment
There was a problem hiding this comment.
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.
Contributor
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5541/ |
1Copenut
approved these changes
Jan 18, 2022
Contributor
1Copenut
left a comment
There was a problem hiding this comment.
👍 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/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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
betaBadgeTooltipPropsto pass a customanchorClassNametoo. 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