amplify-ui
amplify-ui copied to clipboard
S3Image attributes like ALT
Is your feature request related to a problem? Please describe. I need my S3Image with ALT attribute.
Describe the solution you'd like accept all IMG related props
Faced the same problem recently. While team is working for a fix here is workaround:
export const updateImageAlt = (id) => {
const imageContainer = document.getElementById(encodeURI(id))
if (imageContainer && imageContainer.getElementsByTagName) {
const image = imageContainer.getElementsByTagName('img')
if (image && image[0]) {
image[0].alt = id
}
}
}
and
componentDidUpdate() {
updateImageAlt(yourimageid)
}
<S3Image imgKey={yourimageid}/>
We use the AmplifyS3Image
component in my team, but would like it to have an alt
prop in order to meet accessibility requirements. I'd be very happy to submit a PR that adds this.
The PR would be the same feature as PR https://github.com/aws-amplify/amplify-js/pull/6915 but for the new UI components, rather than the legacy component in aws-amplify-react
. @amhinson
Closing out issue as the S3Image
component has been deprecated.