Browse Source

Attachment: add focus style so that it gets highlighted when tabbing through inputs

- also, usability: use a <label> for “select attachment…” and connect it to the <input type=“file”>
Felix Niklas 6 years ago
parent
commit
7d5d2626c2

+ 5 - 2
app/assets/javascripts/app/views/generic/attachment.jst.eco

@@ -2,8 +2,11 @@
 <div class="article-attachment">
   <div class="attachmentPlaceholder">
     <span class="attachmentPlaceholder-inputHolder fileUpload">
-      <%- @T('select attachment...') %>
-      <input multiple="multiple" type="file" name="file" style="">
+      <% uid =  _.uniqueId('fileUpload_') %>
+      <input multiple="multiple" type="file" name="file" id="<%- uid %>">
+      <label class="attachmentPlaceholder-label" for="<%- uid %>">
+        <%- @T('select attachment...') %>
+      </label>
     </span>
   </div>
   <div class="attachmentUpload hide">

+ 6 - 3
app/assets/javascripts/app/views/ticket_zoom/article_new.jst.eco

@@ -69,9 +69,12 @@
         <div class="article-attachment">
           <div class="attachmentPlaceholder">
             <span class="attachmentPlaceholder-hint"><%- @T('Enter Answer or') %></span>
-            <span class="attachmentPlaceholder-inputHolder">
-              <%- @T('select attachment...') %>
-              <input multiple="multiple" type="file" name="file" style="position: absolute; right: 0px; top: 0px; font-family: Arial; font-size: 118px; margin: 0px; padding: 0px; cursor: pointer; opacity: 0;">
+            <span class="attachmentPlaceholder-inputHolder fileUpload">
+              <% uid =  _.uniqueId('fileUpload_') %>
+              <input multiple="multiple" type="file" name="file" id="<%- uid %>">
+              <label class="attachmentPlaceholder-label" for="<%- uid %>">
+                <%- @T('select attachment...') %>
+              </label>
             </span>
           </div>
           <div class="attachmentUpload hide">

+ 6 - 1
app/assets/stylesheets/zammad.scss

@@ -1358,7 +1358,8 @@ label,
 .inline-label,
 .label-success,
 .label-warning,
-.label-danger {
+.label-danger,
+.fileUpload label {
   font-size: inherit;
   font-weight: inherit;
   text-align: inherit;
@@ -7378,6 +7379,10 @@ label + .wizard-buttonList {
   padding: 0;
   @extend %clickable;
   opacity: 0;
+  
+  &:focus + label {
+    text-decoration: underline;
+  }
 }
 
 .imagePreview img {