Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sr-only class for accessibility #31

Merged
merged 1 commit into from
Jun 5, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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