diff options
author | Yamagishi Kazutoshi <ykzts@desire.sh> | 2017-06-15 21:10:41 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-06-15 14:10:41 +0200 |
commit | df4f4e94b3dfb97cc5fc458c86928842f7f396d0 (patch) | |
tree | 268df0e8aeb9af43382b8bdbb7b531aedac7b9c8 /app/javascript | |
parent | 51b2f789bd1d6d4e00f02f5476ff7e6af25fce49 (diff) |
Add alt attribute to ImageLoader (#3765)
Diffstat (limited to 'app/javascript')
-rw-r--r-- | app/javascript/mastodon/features/ui/components/image_loader.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/javascript/mastodon/features/ui/components/image_loader.js b/app/javascript/mastodon/features/ui/components/image_loader.js index b357f28a0..a2514d6be 100644 --- a/app/javascript/mastodon/features/ui/components/image_loader.js +++ b/app/javascript/mastodon/features/ui/components/image_loader.js @@ -4,12 +4,17 @@ import PropTypes from 'prop-types'; class ImageLoader extends React.PureComponent { static propTypes = { + alt: PropTypes.string, src: PropTypes.string.isRequired, previewSrc: PropTypes.string.isRequired, width: PropTypes.number.isRequired, height: PropTypes.number.isRequired, } + static defaultProps = { + alt: '', + }; + state = { loading: true, error: false, @@ -35,12 +40,13 @@ class ImageLoader extends React.PureComponent { } render() { - const { src, previewSrc, width, height } = this.props; + const { alt, src, previewSrc, width, height } = this.props; const { loading, error } = this.state; return ( <div className='image-loader'> - <img // eslint-disable-line jsx-a11y/img-has-alt + <img + alt={alt} className='image-loader__img' src={src} width={width} @@ -48,7 +54,8 @@ class ImageLoader extends React.PureComponent { /> {loading && - <img // eslint-disable-line jsx-a11y/img-has-alt + <img + alt='' src={previewSrc} className='image-loader__preview-img' /> |