Skip to content

Commit

Permalink
Merge pull request #31 from projecthydra-labs/blacklight_upgrade
Browse files Browse the repository at this point in the history
Use sr-only class for accessibility
  • Loading branch information
awead committed Jun 5, 2014
2 parents 4a2e365 + bac7f08 commit 6a73d2b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/hydra-editor/multiForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
var cloneElem = $('#'+cloneId).clone();
// change the add button to a remove button
var plusbttn = cloneElem.find('#'+this.id);
plusbttn.html('-<span class="accessible-hidden">remove this '+ this.name.replace("_", " ") +'</span>');
plusbttn.html('-<span class="sr-only">remove this '+ this.name.replace("_", " ") +'</span>');
plusbttn.on('click',removeField);

// remove the help tag on subsequent added fields
Expand Down
6 changes: 0 additions & 6 deletions app/assets/stylesheets/hydra-editor/hydra-editor.css
Original file line number Diff line number Diff line change
@@ -1,6 +0,0 @@
/* use if a label should be hidden from view but available to screen readers */
.accessible-hidden {
position: absolute !important;
clip: rect(1px 1px 1px 1px); /* IE6, IE7 */
clip: rect(1px, 1px, 1px, 1px);
}
2 changes: 1 addition & 1 deletion app/helpers/concerns/records_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def more_or_less_button(key, html_class, symbol)
# TODO, there could be more than one element with this id on the page, but the fuctionality doesn't work without it.
content_tag('button', class: "#{html_class} btn", id: "additional_#{key}_submit", name: "additional_#{key}") do
(symbol +
content_tag('span', class: 'accessible-hidden') do
content_tag('span', class: 'sr-only') do
"add another #{key.to_s}"
end).html_safe
end
Expand Down
4 changes: 2 additions & 2 deletions spec/helpers/records_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

it "draws add button" do
helper.add_field(:test).should ==
"<button class=\"adder btn\" id=\"additional_test_submit\" name=\"additional_test\">+<span class=\"accessible-hidden\">add another test</span></button>"
"<button class=\"adder btn\" id=\"additional_test_submit\" name=\"additional_test\">+<span class=\"sr-only\">add another test</span></button>"
end

it "draws subtract button" do
helper.subtract_field(:test).should ==
"<button class=\"remover btn\" id=\"additional_test_submit\" name=\"additional_test\">-<span class=\"accessible-hidden\">add another test</span></button>"
"<button class=\"remover btn\" id=\"additional_test_submit\" name=\"additional_test\">-<span class=\"sr-only\">add another test</span></button>"
end

it "draws edit_record_title" do
Expand Down

0 comments on commit 6a73d2b

Please sign in to comment.