summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorByron Jones <bjones@mozilla.com>2014-03-05 15:45:38 +0100
committerByron Jones <bjones@mozilla.com>2014-03-05 15:45:38 +0100
commit4e55e090eed7b6564c203caee535634c09a56920 (patch)
tree04fc7571f25c04776cc109631af041f1c71d1af8
parent146bad3346995496a111ce4a7ee2020572973e98 (diff)
downloadbugzilla-4e55e090eed7b6564c203caee535634c09a56920.tar.gz
bugzilla-4e55e090eed7b6564c203caee535634c09a56920.tar.xz
Bug 977137: Comment and Preview tabs need accessibility markup
r=dkl, a=justdave
-rw-r--r--js/field.js19
-rw-r--r--template/en/default/bug/comment.html.tmpl4
2 files changed, 18 insertions, 5 deletions
diff --git a/js/field.js b/js/field.js
index 670c70a86..51fd1fe86 100644
--- a/js/field.js
+++ b/js/field.js
@@ -994,16 +994,22 @@ function show_comment_preview(bug_id) {
var Dom = YAHOO.util.Dom;
var comment = document.getElementById('comment');
var preview = document.getElementById('comment_preview');
+
if (!comment || !preview) return;
if (Dom.hasClass('comment_preview_tab', 'active_comment_tab')) return;
preview.style.width = (comment.clientWidth - 4) + 'px';
preview.style.height = comment.offsetHeight + 'px';
+ var comment_tab = document.getElementById('comment_tab');
Dom.addClass(comment, 'bz_default_hidden');
- Dom.removeClass('comment_tab', 'active_comment_tab');
+ Dom.removeClass(comment_tab, 'active_comment_tab');
+ comment_tab.setAttribute('aria-selected', 'false');
+
+ var preview_tab = document.getElementById('comment_preview_tab');
Dom.removeClass(preview, 'bz_default_hidden');
- Dom.addClass('comment_preview_tab', 'active_comment_tab');
+ Dom.addClass(preview_tab, 'active_comment_tab');
+ preview_tab.setAttribute('aria-selected', 'true');
Dom.addClass('comment_preview_error', 'bz_default_hidden');
@@ -1054,8 +1060,13 @@ function show_comment_edit() {
if (!comment || !preview) return;
if (YAHOO.util.Dom.hasClass(comment, 'active_comment_tab')) return;
+ var preview_tab = document.getElementById('comment_preview_tab');
YAHOO.util.Dom.addClass(preview, 'bz_default_hidden');
- YAHOO.util.Dom.removeClass('comment_preview_tab', 'active_comment_tab');
+ YAHOO.util.Dom.removeClass(preview_tab, 'active_comment_tab');
+ preview_tab.setAttribute('aria-selected', 'false');
+
+ var comment_tab = document.getElementById('comment_tab');
YAHOO.util.Dom.removeClass(comment, 'bz_default_hidden');
- YAHOO.util.Dom.addClass('comment_tab', 'active_comment_tab');
+ YAHOO.util.Dom.addClass(comment_tab, 'active_comment_tab');
+ comment_tab.setAttribute('aria-selected', 'true');
}
diff --git a/template/en/default/bug/comment.html.tmpl b/template/en/default/bug/comment.html.tmpl
index e30801963..96cbb63ed 100644
--- a/template/en/default/bug/comment.html.tmpl
+++ b/template/en/default/bug/comment.html.tmpl
@@ -13,10 +13,12 @@
#%]
[% IF feature_enabled('jsonrpc') %]
- <div id="comment_tabs">
+ <div id="comment_tabs" role="tablist">
<div id="comment_tab" class="comment_tab active_comment_tab"
+ role="tab" aria-selected="true"
onclick="show_comment_edit()">Comment</div>
<div id="comment_preview_tab" class="comment_tab"
+ role="tab" aria-selected="false"
onclick="show_comment_preview([% bug.id FILTER none %])">Preview</div>
</div>
[% END %]