]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1280393 - [a11y] All inputs and selects need to be labeled properly
authorDavid Lawrence <dkl@mozilla.com>
Thu, 9 Feb 2017 17:33:46 +0000 (17:33 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Thu, 9 Feb 2017 17:33:46 +0000 (17:33 +0000)
extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
extensions/BugModal/template/en/default/bug_modal/new_comment.html.tmpl
template/en/default/global/userselect.html.tmpl

index 08a47b2d6afa9603099eb7fbab7f09526a92929c..ef2922181dff90876d3a88f979b148cbc00ff249 100644 (file)
         container = 1
         hide_on_view = bug.priority == "--" && bug.bug_severity == "normal"
         help = "https://wiki.mozilla.org/BMO/UserGuide/BugFields#priority"
+        label_for = "priority"
     %]
       [% INCLUDE bug_modal/field.html.tmpl
           field = bug_fields.priority
           label        = "Status"
           hide_on_edit = 1
           help         = "https://wiki.mozilla.org/BMO/UserGuide/BugStatuses"
+          label_for    = "bug_status"
       %]
         [% bug.bug_status FILTER html %]
         [%+ bug.resolution FILTER html IF bug.resolution %]
         hide_on_view = (bug.rep_platform == 'All' && bug.op_sys == 'All')
           || (bug.rep_platform == 'Unspecified' && bug.op_sys == 'Unspecified')
         help = "https://wiki.mozilla.org/BMO/UserGuide/BugFields#rep_platform"
+        label_for = "rep_platform"
     %]
       [% INCLUDE bug_modal/field.html.tmpl
           field = bug_fields.rep_platform
     [% WRAPPER bug_modal/field.html.tmpl
         field = bug_fields.status_whiteboard
         field_type = constants.FIELD_TYPE_FREETEXT
-        help = "https://wiki.mozilla.org/BMO/Whiteboard"
+        help = "https://wiki.mozilla.org/BMO/UserGuide/Whiteboard"
     %]
       [% bug.status_whiteboard == "" ? "---" : bug.status_whiteboard FILTER html %]
     [% END %]
index ac501c8d5d54264aa257741d30901d5fa4d416cb..58fc4c30f45f1acdb4e700817bac74332a96cdd7 100644 (file)
@@ -33,6 +33,7 @@
   #   class: (string) optional button class
   #   caption: (string) button caption
   #   hidden: (boolean) don't show the button (default: false)
+  # label_for: (string) optional label for identifier
   #%]
 
 [%
@@ -104,9 +105,21 @@ END;
     <div class="name
                 [%~ " edit-show" IF hide_on_view %]"
          [% IF hide_on_view %] style="display:none"[% END %]>
-      [%~ IF help.defined %]<a href="[% help FILTER none %]" class="help">[% END %]
+      [%~ IF help.defined %]
+        <a href="[% help FILTER none %]" id="[% name FILTER html %]-help-link" class="help">
+        [% aria_labelledby_id = "${name}-help-link" %]
+        [% aria_labelledby_html = BLOCK %]aria-labelledby="[% aria_labelledby_id FILTER html %]"[% END %]
+      [% END %]
+      [%~ IF label_for %]
+        <label for="[% label_for FILTER html %]">
+      [% END %]
       [%~ label _ ":" FILTER html IF label %]
-      [%~ IF help.defined %]</a>[% END ~%]
+      [%~ IF label_for %]
+        </label>
+      [% END ~%]
+      [%~ IF help.defined %]
+        </a>
+      [% END %]
     </div>
   [% END %]
 
@@ -177,7 +190,7 @@ END;
         [% CASE constants.FIELD_TYPE_SINGLE_SELECT %]
           [%# single value select %]
           <input type="hidden" id="[% name FILTER html %]-dirty">
-          <select name="[% name FILTER html %]" id="[% name FILTER html %]">
+          <select name="[% name FILTER html %]" id="[% name FILTER html %]" [% aria_labelledby_html FILTER none %]>
             [% IF values.defined %]
               [% FOREACH v IN values %]
                 [% NEXT IF NOT v.is_active AND NOT value.contains(v.name).size %]
@@ -195,7 +208,7 @@ END;
         [% CASE constants.FIELD_TYPE_MULTI_SELECT %]
           [%# multi value select %]
           <input type="hidden" id="[% name FILTER html %]-dirty">
-          <select name="[% name FILTER html %]" id="[% name FILTER html %]" multiple size="5">
+          <select name="[% name FILTER html %]" id="[% name FILTER html %]" multiple size="5" [% aria_labelledby_html FILTER none %]>
             [% IF values.defined %]
               [%# not implemented %]
             [% ELSE %]
@@ -207,8 +220,7 @@ END;
 
         [% CASE constants.FIELD_TYPE_FREETEXT %]
           [%# normal input field %]
-          <input name="[% name FILTER html %]" id="[% name FILTER html %]" value="[% value FILTER html %]">
-
+          <input name="[% name FILTER html %]" id="[% name FILTER html %]" value="[% value FILTER html %]" [% aria_labelledby_html FILTER none %]>
         [% CASE constants.FIELD_TYPE_USER %]
           [% IF action && !action.hidden %]
             <button class="field-button minor [%= action.class FILTER html IF action.class %]"
@@ -225,6 +237,7 @@ END;
               value = value.login
               classes = [ "bz_userfield" ]
               placeholder = default
+              aria_labelledby = aria_labelledby_id
             %]
           [% IF action && !action.hidden %]
             </div>
@@ -240,12 +253,13 @@ END;
               classes = [ "bz_userfield" ]
               placeholder = default
               multiple = 5
+              aria_labelledby = aria_labelledby_id
             %]
 
         [% CASE constants.FIELD_TYPE_KEYWORDS %]
           [%# keywords %]
           <input type="text" id="[% name FILTER html %]" name="[% name FILTER html %]"
-            value="[% value FILTER html %]">
+            value="[% value FILTER html %]" [% aria_labelledby_html FILTER none %]>
 
         [% CASE constants.FIELD_TYPE_BUG_URLS %]
           [%# see also %]
@@ -265,31 +279,31 @@ END;
               <span class="multiline-value" id="[% name FILTER html %]-view">[% value FILTER html FILTER html_line_break %]</span>
             [% END %]
             <textarea id="[% name FILTER html %]" name="[% name FILTER html %]"
-              rows="10" cols="10" style="display:none">[% value FILTER html %]</textarea>
+              rows="10" cols="10" style="display:none" [% aria_labelledby_html FILTER none %]>[% value FILTER html %]</textarea>
 
         [% CASE constants.FIELD_TYPE_DATETIME %]
           [%# datetime %]
           <input class="cf_datetime" name="[% name FILTER html %]" id="[% name FILTER html %]"
-            value="[% value FILTER html %]">
+            value="[% value FILTER html %]" [% aria_labelledby_html FILTER none %]>
           <img class="cf_datetime-img" id="[% name FILTER html %]-img"
             src="extensions/BugModal/web/calendar.png" width="16" height="16">
 
         [% CASE constants.FIELD_TYPE_DATE %]
           [%# date %]
           <input class="cf_date" name="[% name FILTER html %]" id="[% name FILTER html %]"
-            value="[% value FILTER html %]">
+            value="[% value FILTER html %]" [% aria_labelledby_html FILTER none %]>
           <img class="cf_date-img" id="[% name FILTER html %]-img"
             src="extensions/BugModal/web/calendar.png" width="16" height="16">
 
         [% CASE constants.FIELD_TYPE_INTEGER %]
           [%# integer %]
           <input type="number" name="[% name FILTER html %]" id="[% name FILTER html %]"
-            value="[% value FILTER html %]">
+            value="[% value FILTER html %]" [% aria_labelledby_html FILTER none %]>
 
         [% CASE constants.FIELD_TYPE_BUG_ID %]
           [%# bug id %]
           <input type="text" name="[% name FILTER html %]" id="[% name FILTER html %]"
-            value="[% value FILTER html %]">
+            value="[% value FILTER html %]" [% aria_labelledby_html FILTER none %]>
 
         [% CASE %]
           [%# error %]
@@ -339,6 +353,6 @@ END;
     [% END %]
   [% ELSE %]
     <input type="text" id="[% name FILTER html %]" name="[% name FILTER html %]"
-           value="[% values.pluck('id').join(", ") FILTER html %]">
+           value="[% values.pluck('id').join(", ") FILTER html %]" [% aria_labelledby_html FILTER none %]>
   [% END %]
 [% END %]
index 60bf2b29afe96c578b5e5388c2f63ce992e33bbe..63663b4d56d8faec986b932c242edfa6acc1baad 100644 (file)
@@ -42,7 +42,7 @@
   </ul>
 
   <div id="comment-edit-tabpanel" class="comment-tabpanel" role="tabpanel" aria-labelledby="comment-edit-tab">
-    <textarea rows="5" cols="80" name="comment" id="comment"></textarea>
+    <textarea rows="5" cols="80" name="comment" id="comment" aria-labelledby="comment-edit-tab"></textarea>
   </div>
   <div id="comment-preview-tabpanel" class="comment-tabpanel" role="tabpanel" aria-labelledby="comment-preview-tab" style="display:none">
     <pre id="comment-preview" class="comment-text"></pre>
index 5577448fb3829522636684242287f82846ea5860..18e38e1f2ae5e7864b93f4995f4ef38fd31bb6c7 100644 (file)
@@ -21,6 +21,7 @@
   # field_title: optional, extra information to display as a tooltip
   # placeholder: optional, input only; placeholder attribute value
   # mandatory: optional; if true, the field cannot be empty.
+  # aria_labelledby: optiona; extra information to use for arai labels
   #%]
 
 [% THROW "onchange is not allowed" IF onchange %]
@@ -34,6 +35,7 @@
   [% IF multiple %] multiple="multiple" size="[% multiple FILTER html %]" [% END %]
   [% IF field_title %] title="[% field_title FILTER html %]" [% END %]
   [% IF mandatory %] required [% END %]
+  [% IF aria_labelledby %]aria-labelledby="[% aria_labelledby FILTER html %]"[% END %]
 >
   [% IF emptyok %]
     <option value=""></option>