cloudinary-react: Rendered img tag missing alt attribute
See original GitHub issueBug report for Cloudinary React SDK
Before proceeding, please update to latest version and test if the issue persists Done
Describe the bug in a sentence or two.
Rendered img
tag is missing required alt
attribute. I have made sure I have a value set for the image’s “Description (alt)” field in Cloudinary’s UI, but it does not get output to the front-end.
Issue Type (Can be multiple)
[ ] Build - Can’t install or import the SDK [ ] Babel - Babel errors or cross browser issues [ ] UI/Performance - Display or performance issues [X] Behaviour - Functions aren’t working as expected (Such as generate URL) [ ] Documentation - Inconsistency between the docs and behaviour [ ] Incorrect Types - For typescript users who are having problems with our d.ts files [ ] Other (Specify)
Steps to reproduce
- Upload an image
- Set its “Description (alt)” field to some text
- Copy its public_id for use in the next step
import {Image} from 'cloudinary-react' /* ... later ... */ <Image publicId={public_id} />
- Use a browser’s web inspector to note that the rendered
img
tag is missing the requiredalt
attribute.
Error screenshots
Browsers (if issue relates to UI, else ignore)
[ ] Chrome [ ] Firefox [ ] Safari [ ] Other (Specify) [X] All
Versions and Libraries (fill in the version numbers)
React Cloudinary SDK - 1.5.0 React - 16.13.1 Create-React-App - N/A
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top GitHub Comments
Thanks for the quick reply. I respectfully disagree that this issue is resolved as the point is that an
img
tag must have analt
attribute. Even if purely presentational, the alt attribute must still exist but be blank, eg:alt=“”
.Also, given the declarative nature of the React wrapper, it seems strange to require users to retrieve the
alt
text imperatively. It removes the convenience if such required functionality needs to be implemented manually.Sure, thank you for reaching out! In my opinion, having an informative
alt
is indeed important, and should be set. It can also help with SEO.