From bac7f0827d46a4ec7ac5974212085cc31794518d Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Tue, 6 May 2014 16:07:48 -0500 Subject: [PATCH] Use sr-only class for accessibility --- app/assets/javascripts/hydra-editor/multiForm.js | 2 +- app/assets/stylesheets/hydra-editor/hydra-editor.css | 6 ------ app/helpers/concerns/records_helper_behavior.rb | 2 +- spec/helpers/records_helper_spec.rb | 4 ++-- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/hydra-editor/multiForm.js b/app/assets/javascripts/hydra-editor/multiForm.js index 6a7caf2..8f418ab 100644 --- a/app/assets/javascripts/hydra-editor/multiForm.js +++ b/app/assets/javascripts/hydra-editor/multiForm.js @@ -11,7 +11,7 @@ var cloneElem = $('#'+cloneId).clone(); // change the add button to a remove button var plusbttn = cloneElem.find('#'+this.id); - plusbttn.html('-remove this '+ this.name.replace("_", " ") +''); + plusbttn.html('-remove this '+ this.name.replace("_", " ") +''); plusbttn.on('click',removeField); // remove the help tag on subsequent added fields diff --git a/app/assets/stylesheets/hydra-editor/hydra-editor.css b/app/assets/stylesheets/hydra-editor/hydra-editor.css index 22a91ed..e69de29 100644 --- a/app/assets/stylesheets/hydra-editor/hydra-editor.css +++ b/app/assets/stylesheets/hydra-editor/hydra-editor.css @@ -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); -} diff --git a/app/helpers/concerns/records_helper_behavior.rb b/app/helpers/concerns/records_helper_behavior.rb index f027706..92e44ba 100644 --- a/app/helpers/concerns/records_helper_behavior.rb +++ b/app/helpers/concerns/records_helper_behavior.rb @@ -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 diff --git a/spec/helpers/records_helper_spec.rb b/spec/helpers/records_helper_spec.rb index 61abd0d..2605001 100644 --- a/spec/helpers/records_helper_spec.rb +++ b/spec/helpers/records_helper_spec.rb @@ -10,12 +10,12 @@ it "draws add button" do helper.add_field(:test).should == - "" + "" end it "draws subtract button" do helper.subtract_field(:test).should == - "" + "" end it "draws edit_record_title" do