Skip to content

Commit

Permalink
Revert "Bug 1280397 - [a11y] Make the component, product, and other l…
Browse files Browse the repository at this point in the history
…atches accessible"

This reverts commit c768148.
  • Loading branch information
dklawren committed Jan 27, 2017
1 parent 6cadcc1 commit 2fcef7a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 84 deletions.
45 changes: 17 additions & 28 deletions extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
Expand Up @@ -346,12 +346,8 @@
hide_on_edit = can_edit_product
help = "describecomponents.cgi"
%]
<span aria-hidden="true" class="spin-latch" id="product-latch"
data-latch="product" data-for="product">&#9656;</span>
<div role="button" aria-label="show product information"
title="show product information" tabindex="0"
aria-expanded="false" class="spin-toggle" id="product-name"
data-latch="product" data-for="product">
<span class="spin-latch" id="product-latch" data-latch="#product-latch" data-for="#product-info">&#9656;</span>
<div class="spin-toggle" data-latch="#product-latch" data-for="#product-info">
[% bug.product FILTER html %]
</div>
<div id="product-info" style="display:none">
Expand Down Expand Up @@ -388,13 +384,9 @@
field_type = constants.FIELD_TYPE_SINGLE_SELECT
help = "describecomponents.cgi"
%]
<span aria-hidden="true" class="spin-latch" id="component-latch"
data-latch="component" data-for="component">&#9656;</span>
<div role="button" aria-label="show component description"
title="show component information" tabindex="0"
aria-expanded="false" class="spin-toggle" id="component-name"
data-latch="#component-latch" data-for="component">
[% bug.component FILTER html %]
<span class="spin-latch" id="component-latch" data-latch="#component-latch" data-for="#component-info">&#9656;</span>
<div class="spin-toggle" data-latch="#component-latch" data-for="#component-info">
[% bug.component FILTER html %]
</div>
<div id="component-info" style="display:none">
<div>[% bug.component_obj.description FILTER html_light %]</div>
Expand Down Expand Up @@ -683,21 +675,18 @@
[% END %]

[% IF bug.cc && bug.cc.size %]
<span aria-owns="cc-latch cc-summary">
[% IF user.id %]
<input type="hidden" name="removecc" id="removecc">
<span role="button" aria-label="show cc list" tabindex="0" id="cc-latch">&#9656;</span>
[% END %]
<span role="button" aria-label="show cc list" tabindex="0"
id="cc-summary" data-count="[% bug.cc.size FILTER none %]">
[%
IF bug.cc.size == 1;
is_cced ? "Just you" : "1 person";
ELSE;
bug.cc.size _ " people";
END;
%]
</span>
[% IF user.id %]
<input type="hidden" name="removecc" id="removecc">
<span id="cc-latch">&#9656;</span>
[% END %]
<span id="cc-summary" data-count="[% bug.cc.size FILTER none %]">
[%
IF bug.cc.size == 1;
is_cced ? "Just you" : "1 person";
ELSE;
bug.cc.size _ " people";
END;
%]
</span>
[% ELSE %]
<i>Nobody</i>
Expand Down
81 changes: 25 additions & 56 deletions extensions/BugModal/web/bug_modal.js
Expand Up @@ -163,38 +163,20 @@ $(function() {
// product/component info
$('.spin-toggle, #product-latch, #component-latch')
.click(function(event) {
spin_toggle(event);
}).keydown(function(event) {
// allow space or enter to toggle visibility
if (event.keyCode == 13 || event.keyCode == 32) {
spin_toggle(event);
event.preventDefault();
var latch = $($(event.target).data('latch'));
var el_for = $($(event.target).data('for'));

if (latch.data('expanded')) {
latch.data('expanded', false).html('&#9656;');
el_for.hide();
}
else {
latch.data('expanded', true).html('&#9662;');
el_for.show();
}
});

function spin_toggle(event) {
event.preventDefault();
var type = $(event.target).data('for');
var latch = $('#' + type + '-latch');
var name = $('#' + type + '-name');
var info = $('#' + type + '-info');
var label = name.attr('aria-label');

if (latch.data('expanded')) {
label = label.replace(/^hide/, 'show');
latch.data('expanded', false).html('&#9656;');
name.attr('aria-expanded', false);
info.hide();
}
else {
label = label.replace(/^show/, 'hide');
latch.data('expanded', true).html('&#9662;');
name.attr('aria-expanded', true);
info.show();
}
name.attr('aria-label', label);
name.attr('title', label);
}

// cc list

function ccListLoading() {
Expand Down Expand Up @@ -248,37 +230,24 @@ $(function() {
$('#cc-summary').addClass('cc-loadable');
$('#cc-latch, #cc-summary')
.click(function(event) {
cc_toggle(event);
}).keydown(function(event) {
// allow space or enter to toggle visibility
if (event.keyCode == 13 || event.keyCode == 32) {
cc_toggle(event);
event.preventDefault();
var latch = $('#cc-latch');

if (latch.data('expanded')) {
latch.data('expanded', false).html('&#9656;');
$('#cc-list').hide();
}
else {
latch.data('expanded', true).html('&#9662;');
$('#cc-list').show();
if (!latch.data('fetched')) {
ccListLoading();
ccListUpdate();
}
}
});
}

function cc_toggle(event) {
event.preventDefault();
var latch = $('#cc-latch');
var label = latch.attr('aria-label');
if (latch.data('expanded')) {
label = label.replace(/^hide/, 'show');
latch.data('expanded', false).html('&#9656;');
$('#cc-list').hide();
}
else {
latch.data('expanded', true).html('&#9662;');
label = label.replace(/^show/, 'hide');
$('#cc-list').show();
if (!latch.data('fetched')) {
ccListLoading();
ccListUpdate();
}
}
latch.attr('aria-label', label);
$('#cc-summary').attr('aria-label', label);
}

// copy summary to clipboard

function clipboardSummary() {
Expand Down

0 comments on commit 2fcef7a

Please sign in to comment.