-
Notifications
You must be signed in to change notification settings - Fork 861
EuiIcon a11y #2554
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
EuiIcon a11y #2554
Conversation
|
Added @myasonik as a required reviewer on this. He's likely the most expert on this subject. I know that using a camelCase icon name as a default is likely not optimal, but let's be considerate of the upgrade cost of a change like this and understand we likely need some baby steps to get out of it properly. We should consider putting a deprecation schedule tied to making title a required prop at a later date. |
myasonik
left a comment
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.
🎉 Thank you for tackling this!
I think if we can solve the naming thing, that it would actually be a pretty good default for a high amount of cases and we wouldn't have to force developers to provide a title or other label all the time. Though, solving the titling issue might be non-trivial as well...
src/components/context_menu/__snapshots__/context_menu.test.tsx.snap
Outdated
Show resolved
Hide resolved
myasonik
left a comment
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.
Looks good to merge!
Two remaining issues can be tabled for later if you make issues for them:
- translating the icon names
- updating this to use
aria-labelledbyafter SVGR is updated
cchaos
left a comment
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.
We also definitely need some sort of callout or section in the docs for providing the correct a11y prop to icons.
@chandlerprall Can you look this over for i18n correctness and the changes to the compile-icons script?
Co-Authored-By: Caroline Horn <[email protected]>
cchaos
left a comment
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 have tested out all the permutations of adding title vs aria-label vs aria-labelledby vs aria-hidden and they all work correctly. I just have some improvement comments.
|
You will also want to update the summary of the PR since we're no longer using the |
Co-Authored-By: Caroline Horn <[email protected]>
Co-Authored-By: Caroline Horn <[email protected]>
Co-Authored-By: Caroline Horn <[email protected]>
Co-Authored-By: Caroline Horn <[email protected]>
@cchaos we're actually using a title tag. When the The only issue we had with The title enhances the SVGs a11y, but because the support isn't uniform we're using the aria-label as a fallback. |
Co-Authored-By: Caroline Horn <[email protected]>
cchaos
left a comment
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.
Just notice that two comments were still not addressed
cchaos
left a comment
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.
Thanks for those last changes. LGTM 👍
@chandlerprall Can you do a final pass?
chandlerprall
left a comment
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 & tested locally
Summary
Closes #1917.
In this PR I’m changing the way SVGR compiles the icons by adding a title tag.
In the
icon.tsxI’m passing a title prop to the SVG. If the prop is empty, by default the title is going to be the name of the icon.When the icon is rendered as an inline SVG this title is passed to the
titletag and it's added to thearia-labelattribute. When the icon is rendered as animagetag the title is added to thealtattribute.In cases, the aria-hidden is set to true the aria-labelledby or aria-label will be ignored.
Checklist