amplify-ui icon indicating copy to clipboard operation
amplify-ui copied to clipboard

S3Image attributes like ALT

Open muriloneo opened this issue 4 years ago • 2 comments

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

muriloneo avatar Jul 23 '20 13:07 muriloneo

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}/>

dmoskovtsov avatar Dec 15 '20 13:12 dmoskovtsov

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

stephenjbradshaw avatar Apr 10 '21 10:04 stephenjbradshaw

Closing out issue as the S3Image component has been deprecated.

reesscot avatar Dec 12 '22 23:12 reesscot