]> cat aescling's git repositories - mastodon.git/commitdiff
Change media description label to be context-sensitive (#12270)
authorThibG <thib@sitedethib.com>
Thu, 21 Nov 2019 10:39:07 +0000 (11:39 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Thu, 21 Nov 2019 10:39:07 +0000 (11:39 +0100)
“Describe for the visually impaired” makes no sense when the uploaded media
is an audio file.

app/javascript/mastodon/features/ui/components/focal_point_modal.js

index bbd463fca921d05d59ff2b3b469b5f2fedc15fad..ddbe3961d23b96474cc879b2156a6eeeb1a7fbba 100644 (file)
@@ -244,6 +244,16 @@ class FocalPointModal extends ImmutablePureComponent {
     const previewWidth  = 200;
     const previewHeight = previewWidth / previewRatio;
 
+    let descriptionLabel = null;
+
+    if (media.get('type') === 'audio') {
+      descriptionLabel = <FormattedMessage id='upload_form.audio_description' defaultMessage='Describe for people with hearing loss' />;
+    } else if (media.get('type') === 'video') {
+      descriptionLabel = <FormattedMessage id='upload_form.video_description' defaultMessage='Describe for people with hearing loss or visual impairment' />;
+    } else {
+      descriptionLabel = <FormattedMessage id='upload_form.description' defaultMessage='Describe for the visually impaired' />;
+    }
+
     return (
       <div className='modal-root__modal report-modal' style={{ maxWidth: 960 }}>
         <div className='report-modal__target'>
@@ -255,7 +265,9 @@ class FocalPointModal extends ImmutablePureComponent {
           <div className='report-modal__comment'>
             {focals && <p><FormattedMessage id='upload_modal.hint' defaultMessage='Click or drag the circle on the preview to choose the focal point which will always be in view on all thumbnails.' /></p>}
 
-            <label className='setting-text-label' htmlFor='upload-modal__description'><FormattedMessage id='upload_form.description' defaultMessage='Describe for the visually impaired' /></label>
+            <label className='setting-text-label' htmlFor='upload-modal__description'>
+              {descriptionLabel}
+            </label>
 
             <div className='setting-text__wrapper'>
               <Textarea