Remove description for screen readers
It was being duplicated when restoring a page by using browser history. With this solution we will avoid to have screen readers descriptions more than once inside any sociual share button.
This commit is contained in:
@@ -173,6 +173,7 @@ var destroy_non_idempotent_modules = function() {
|
|||||||
App.Datepicker.destroy();
|
App.Datepicker.destroy();
|
||||||
App.HTMLEditor.destroy();
|
App.HTMLEditor.destroy();
|
||||||
App.LegislationAnnotatable.destroy();
|
App.LegislationAnnotatable.destroy();
|
||||||
|
App.SocialShare.destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).on("turbolinks:load", initialize_modules);
|
$(document).on("turbolinks:load", initialize_modules);
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
$(".social-share-button a").each(function() {
|
$(".social-share-button a").each(function() {
|
||||||
$(this).append("<span class='show-for-sr'>" + ($(this).data("site")) + "</span>");
|
$(this).append("<span class='show-for-sr'>" + ($(this).data("site")) + "</span>");
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
destroy: function() {
|
||||||
|
$(".social-share-button a .show-for-sr").remove();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|||||||
@@ -198,6 +198,18 @@ describe "Proposals" do
|
|||||||
expect(page).not_to have_link("No comments", href: "#comments")
|
expect(page).not_to have_link("No comments", href: "#comments")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "After using the browser's back button, social buttons will have one screen reader", :js do
|
||||||
|
proposal = create(:proposal)
|
||||||
|
visit proposal_path(proposal)
|
||||||
|
click_link "Help"
|
||||||
|
|
||||||
|
expect(page).to have_content "CONSUL is a platform for citizen participation"
|
||||||
|
|
||||||
|
go_back
|
||||||
|
|
||||||
|
expect(page).to have_css "span.show-for-sr", text: "twitter", count: 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Show sticky support button on mobile screens", :js do
|
describe "Show sticky support button on mobile screens", :js do
|
||||||
|
|||||||
Reference in New Issue
Block a user