about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHolden Foreman <38192823+hs4man21@users.noreply.github.com>2023-01-05 07:36:42 -0500
committerClaire <claire.github-309c@sitedethib.com>2023-01-05 15:12:33 +0100
commit4f335da8f88fccf4285023208664bd8594a1deb9 (patch)
treeb4aac2b1342696ea8b075133729913fe4c0b2f56
parent1702907a9d26a8e3aa5e4567487cb21ee3fc2a8c (diff)
[Glitch] Add aria-hidden to 'Hide image' button in MediaGallery since the button is useless to screen reader users
Port c5da2f8c439f86f809d750b42aa11cdeef6b7c1f to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
-rw-r--r--app/javascript/flavours/glitch/components/icon_button.js4
-rw-r--r--app/javascript/flavours/glitch/components/media_gallery.js2
2 files changed, 5 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/components/icon_button.js b/app/javascript/flavours/glitch/components/icon_button.js
index 41a95e92f..2485f0f48 100644
--- a/app/javascript/flavours/glitch/components/icon_button.js
+++ b/app/javascript/flavours/glitch/components/icon_button.js
@@ -30,6 +30,7 @@ export default class IconButton extends React.PureComponent {
     counter: PropTypes.number,
     obfuscateCount: PropTypes.bool,
     href: PropTypes.string,
+    ariaHidden: PropTypes.bool,
   };
 
   static defaultProps = {
@@ -39,6 +40,7 @@ export default class IconButton extends React.PureComponent {
     animate: false,
     overlay: false,
     tabIndex: '0',
+    ariaHidden: false,
   };
 
   state = {
@@ -115,6 +117,7 @@ export default class IconButton extends React.PureComponent {
       counter,
       obfuscateCount,
       href,
+      ariaHidden,
     } = this.props;
 
     const {
@@ -155,6 +158,7 @@ export default class IconButton extends React.PureComponent {
       <button
         aria-label={title}
         aria-expanded={expanded}
+        aria-hidden={ariaHidden}
         title={title}
         className={classes}
         onClick={this.handleClick}
diff --git a/app/javascript/flavours/glitch/components/media_gallery.js b/app/javascript/flavours/glitch/components/media_gallery.js
index ac0d05926..23e279589 100644
--- a/app/javascript/flavours/glitch/components/media_gallery.js
+++ b/app/javascript/flavours/glitch/components/media_gallery.js
@@ -376,7 +376,7 @@ class MediaGallery extends React.PureComponent {
         </button>
       );
     } else if (visible) {
-      spoilerButton = <IconButton title={intl.formatMessage(messages.toggle_visible, { number: size })} icon='eye-slash' overlay onClick={this.handleOpen} />;
+      spoilerButton = <IconButton title={intl.formatMessage(messages.toggle_visible, { number: size })} icon='eye-slash' overlay onClick={this.handleOpen} ariaHidden />;
     } else {
       spoilerButton = (
         <button type='button' onClick={this.handleOpen} className='spoiler-button__overlay'>