-
Notifications
You must be signed in to change notification settings - Fork 834
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
Ensure alt attribute in custom icon img elements #3245
Ensure alt attribute in custom icon img elements #3245
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_3245/ |
I'm on the fence about approving this. On one hand, this does work... On the other hand, I don't know if I trust devs to remember to pass in a value for The way it currently stands, pages will fail automated testing when/if that's the case and the images can be triaged. (Assuming that devs are doing automated testing...) That can be annoying but should be a one time cost. For Kibana as an example, as the automated testing gets broader and broader it should also stop these things from ever even being merged in the first place. With this change, all images will appear to pass automated testing but false negatives are incredibly difficult to spot... Can someone convince me one way or the other? |
When the icons are rendered as We also have this EuiCallOut on top of the page to ensure devs pass a title: For me, it makes sense the I think it will always be difficult to track false negatives. So we have to assume devs are going to follow the best practices we recommend in the docs. But @myasonik I think you're the right person to make a decision here. |
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.
@miukimiu You convinced me by saying this would bring it inline with how svg
s are currently handled. At least it'll be consistent 😅
🚀
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! 🎉
Summary
This PR fixes the
img
element inEuiIcon
components using custom SVGs to have analt
attribute with an empty string, rather than noalt
attribute at all. This ensures validation while also indicating to screen readers to not read icons that are for decoration purposes only.Checklist
- [ ] Check against all themes for compatibility in both light and dark modes- [ ] Checked in mobile- [ ] Checked in IE11 and Firefox- [ ] Props have proper autodocs- [ ] Added documentation examples- [ ] Added or updated jest tests- [ ] Checked for breaking changes and labeled appropriately