-
Notifications
You must be signed in to change notification settings - Fork 843
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
Fixed EuiBetaBadge a11y #2559
Fixed EuiBetaBadge a11y #2559
Conversation
Fix for a11y by making the span focusable and adds focus ring for visual indicator
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.
Changes LGTM; pulled and tested beta badge docs locally
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.
I thought on this PR for a long while... Probably longer than I needed to...
Just adding a tabIndex
to a non-interactive element doesn't sit right but I couldn't figure out a smarter solution and it largely works, so, ultimately a 👍 from me. It definitely improves on the current state!
Ignoring the semantics of it, the one practical issue I came across is when navigating the page with a screen reader (not jumping around with TAB), the description isn't read out and nothing tells me that this element is something special so I should focus on it.
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.
Tested locally and LGTM! 🎉
@myasonik Yeah it's more of a limitation of our basic tooltip behavior than specific to EuiBetaBadge that we should address at some point. Thanks! |
Summary
Since EuiBetaBadge's don't actually have any clickability to them, they were ignored from the tab order and therefore, the description which only shows on hover could never be read by a screenreader. This PR basically just adds
tab-index=0
to the element putting it into the focus order of the DOM. We handle this the same way for EuiIconTip.This also then required moving the DOM order of the beta badge in EuiCard so that it didn't come before the title of the card.
Checklist
[ ] Checked in dark mode[ ] Checked in mobile[ ] Props have proper autodocs[ ] Added documentation examples[ ] Added or updated jest tests[ ] Checked for breaking changes and labeled appropriately