]> Untitled Git - lemmy-ui.git/commitdiff
fix(a11y): Change image remove button to true button element
authorJay Sitter <jay@jaysitter.com>
Sat, 24 Jun 2023 23:44:22 +0000 (19:44 -0400)
committerJay Sitter <jay@jaysitter.com>
Sat, 24 Jun 2023 23:44:22 +0000 (19:44 -0400)
src/assets/css/main.css
src/shared/components/common/image-upload-form.tsx

index d61dafdae558a2f0cdfcee842ce869b56034ef1d..a93055ed1b3bece8ebd9341309ea5a100309460d 100644 (file)
@@ -275,10 +275,7 @@ hr {
 }
 
 .mini-overlay {
-  position: absolute;
-  top: 0;
-  right: 0;
-  padding: 2px;
+  display: block;
   height: 1.5em;
   width: 1.5em;
   background: rgba(0, 0, 0, 0.4);
index 5f68ea54ff5d1c2267e1515ff036a3e1f07ac060..f217cfab5af0c0400a9a795dae26fa61b9c39ce1 100644 (file)
@@ -39,7 +39,9 @@ export class ImageUploadForm extends Component<
         >
           {this.props.imageSrc ? (
             <span className="d-inline-block position-relative">
+              {/* TODO: Create "Current Iamge" translation for alt text */}
               <img
+                alt=""
                 src={this.props.imageSrc}
                 height={this.props.rounded ? 60 : ""}
                 width={this.props.rounded ? 60 : ""}
@@ -47,12 +49,14 @@ export class ImageUploadForm extends Component<
                   this.props.rounded ? "rounded-circle" : ""
                 }`}
               />
-              <a
+              <button
+                className="position-absolute d-block p-0 end-0 border-0 top-0 bg-transparent"
+                type="button"
                 onClick={linkEvent(this, this.handleRemoveImage)}
                 aria-label={I18NextService.i18n.t("remove")}
               >
                 <Icon icon="x" classes="mini-overlay" />
-              </a>
+              </button>
             </span>
           ) : (
             <span className="btn btn-secondary">{this.props.uploadTitle}</span>