-
-
Notifications
You must be signed in to change notification settings - Fork 638
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
Extend alt-text rule to check for any element with role="img" as well #957
Comments
You can designate a specific custom component to act as an image: https://github.com/jsx-eslint/eslint-plugin-jsx-a11y#configurations You can also use https://github.com/jsx-eslint/eslint-plugin-jsx-a11y#polymorphic-components, although that kind of design is not recommended (iow, using "role" on an HTML element). |
Thank you @ljharb . I attempted to try the above but was unsuccessful, Sorry am a novice to React and jsx-a11y. I was wondering if I can extend the alt-text rule in the estlintrc config to include div role="img" kind of elements also. Pretty much the same kind of check for aria-label/aria-labelledby needs to be done for any element with role="img" too |
no, but you can use the polymorphic components setting to make divs with a role of "img" be treated like |
@ljharb Hi, sorry for bumping a year old thread, but it's not resolved and I've just come across this issue myself. |
@grumd yes - you can combine What's your use case for a non- |
This is not a bug but rather looking for some guidance on how can I extend the alt-text rule to include elements that have role="img" as well. Guidance is highly appreciated.
The text was updated successfully, but these errors were encountered: