react-pdf
react-pdf copied to clipboard
No option to add alt tag to image components
Using images with react-pdf works, but during the build process of the app (npm run build) results in the warning:
Warning: Image elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text
Having an option for an alt tag would solve this.
I am interested in solving this issue. Please let me know if I can proceed.
I'm facing same issue too. If anyone can provide example how it should fixed, I'm eager to do some collabration too. Thanks
That's a linting error. Seems like your linting rule is thinking react-pdf image is a dom image. Not sure what alt means in a PDF. I guess an accessibility tag to the image? There are issues creatd for accessibility. Will close
You can use use import aliasing to "solve" this: import { Image as PDFImage } from "@react-pdf/renderer";
I am no expert in creating or rendering PDFs, but a quick search found that it is possible to use tagging to tag images with an ALT-Text for a11y-Readers. (In case you are unable to visually inspect images etc.)
As I found that this project uses pdfkit at some point, it could be possible to create ALT-texts with the a11y features of pdfkit: https://pdfkit.org/docs/accessibility.html