Merge pull request #6144 from consuldemocracy/serious_accessibility_issues
Fix most Axe serious accessibility issues
This commit is contained in:
8
app/assets/javascripts/account_menu.js
Normal file
8
app/assets/javascripts/account_menu.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
(function() {
|
||||||
|
"use strict";
|
||||||
|
App.AccountMenu = {
|
||||||
|
initialize: function() {
|
||||||
|
$(".account-menu > li > form button").attr("role", "menuitem");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}).call(this);
|
||||||
@@ -117,6 +117,7 @@
|
|||||||
//= require budget_edit_associations
|
//= require budget_edit_associations
|
||||||
//= require budget_hide_money
|
//= require budget_hide_money
|
||||||
//= require datepicker
|
//= require datepicker
|
||||||
|
//= require account_menu
|
||||||
//= require authenticity_token_refresh
|
//= require authenticity_token_refresh
|
||||||
//= require_tree ./admin
|
//= require_tree ./admin
|
||||||
//= require_tree ./polls
|
//= require_tree ./polls
|
||||||
@@ -181,6 +182,7 @@ var initialize_modules = function() {
|
|||||||
App.PollsForm.initialize();
|
App.PollsForm.initialize();
|
||||||
App.SDGRelatedListSelector.initialize();
|
App.SDGRelatedListSelector.initialize();
|
||||||
App.SDGManagementRelationSearch.initialize();
|
App.SDGManagementRelationSearch.initialize();
|
||||||
|
App.AccountMenu.initialize();
|
||||||
App.AuthenticityTokenRefresh.initialize();
|
App.AuthenticityTokenRefresh.initialize();
|
||||||
App.CookiesConsent.initialize();
|
App.CookiesConsent.initialize();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,17 +28,19 @@
|
|||||||
markers = L.layerGroup();
|
markers = L.layerGroup();
|
||||||
}
|
}
|
||||||
marker = null;
|
marker = null;
|
||||||
markerIcon = L.divIcon({
|
markerIcon = function(alt_text) {
|
||||||
className: "map-marker",
|
return L.divIcon({
|
||||||
iconSize: [30, 30],
|
className: "map-marker",
|
||||||
iconAnchor: [15, 40],
|
iconSize: [30, 30],
|
||||||
html: '<div class="map-icon"></div>'
|
iconAnchor: [15, 40],
|
||||||
});
|
html: $('<div class="map-icon"></div>').attr("aria-label", alt_text)[0].outerHTML
|
||||||
createMarker = function(latitude, longitude) {
|
});
|
||||||
|
};
|
||||||
|
createMarker = function(latitude, longitude, text) {
|
||||||
var newMarker, markerLatLng;
|
var newMarker, markerLatLng;
|
||||||
markerLatLng = new L.LatLng(latitude, longitude);
|
markerLatLng = new L.LatLng(latitude, longitude);
|
||||||
newMarker = L.marker(markerLatLng, {
|
newMarker = L.marker(markerLatLng, {
|
||||||
icon: markerIcon,
|
icon: markerIcon(text),
|
||||||
draggable: editable
|
draggable: editable
|
||||||
});
|
});
|
||||||
if (editable) {
|
if (editable) {
|
||||||
@@ -71,7 +73,7 @@
|
|||||||
|
|
||||||
markerData = App.Map.markerData(element);
|
markerData = App.Map.markerData(element);
|
||||||
if (markerData.lat && markerData.long && !investmentsMarkers) {
|
if (markerData.lat && markerData.long && !investmentsMarkers) {
|
||||||
marker = createMarker(markerData.lat, markerData.long);
|
marker = createMarker(markerData.lat, markerData.long, markerData.title);
|
||||||
}
|
}
|
||||||
if (editable) {
|
if (editable) {
|
||||||
$(removeMarkerSelector).on("click", removeMarker);
|
$(removeMarkerSelector).on("click", removeMarker);
|
||||||
@@ -115,7 +117,8 @@
|
|||||||
|
|
||||||
dataCoordinates = {
|
dataCoordinates = {
|
||||||
lat: $(element).data("marker-latitude"),
|
lat: $(element).data("marker-latitude"),
|
||||||
long: $(element).data("marker-longitude")
|
long: $(element).data("marker-longitude"),
|
||||||
|
title: $(element).data("marker-title")
|
||||||
};
|
};
|
||||||
formCoordinates = {
|
formCoordinates = {
|
||||||
lat: inputs.lat.val(),
|
lat: inputs.lat.val(),
|
||||||
@@ -133,6 +136,7 @@
|
|||||||
return {
|
return {
|
||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude,
|
long: longitude,
|
||||||
|
title: dataCoordinates.title,
|
||||||
zoom: formCoordinates.zoom
|
zoom: formCoordinates.zoom
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -188,7 +192,7 @@
|
|||||||
var marker;
|
var marker;
|
||||||
|
|
||||||
if (App.Map.validCoordinates(coordinates)) {
|
if (App.Map.validCoordinates(coordinates)) {
|
||||||
marker = createMarker(coordinates.lat, coordinates.long);
|
marker = createMarker(coordinates.lat, coordinates.long, coordinates.title);
|
||||||
marker.options.id = coordinates.investment_id;
|
marker.options.id = coordinates.investment_id;
|
||||||
marker.bindPopup(App.Map.getPopupContent(coordinates));
|
marker.bindPopup(App.Map.getPopupContent(coordinates));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
class: "legislation-draft-version-body" %>
|
class: "legislation-draft-version-body" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="small-12 medium-6 column markdown-preview">
|
<div class="small-12 medium-6 column markdown-preview" tabindex="0">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class Shared::MapLocationComponent < ApplicationComponent
|
|||||||
marker_investments_coordinates: investments_coordinates,
|
marker_investments_coordinates: investments_coordinates,
|
||||||
marker_latitude: map_location.latitude.presence,
|
marker_latitude: map_location.latitude.presence,
|
||||||
marker_longitude: map_location.longitude.presence,
|
marker_longitude: map_location.longitude.presence,
|
||||||
|
marker_title: map_location.title.presence,
|
||||||
marker_clustering: feature?("map.feature.marker_clustering"),
|
marker_clustering: feature?("map.feature.marker_clustering"),
|
||||||
geozones: geozones_data
|
geozones: geozones_data
|
||||||
}.merge(input_selectors)
|
}.merge(input_selectors)
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ class MapLocation < ApplicationRecord
|
|||||||
latitude.present? && longitude.present? && zoom.present?
|
latitude.present? && longitude.present? && zoom.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def title
|
||||||
|
(proposal || investment)&.title
|
||||||
|
end
|
||||||
|
|
||||||
def json_data
|
def json_data
|
||||||
{
|
{
|
||||||
investment_id: investment_id,
|
investment_id: investment_id,
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
|
|||||||
find("#new_map_location").click
|
find("#new_map_location").click
|
||||||
|
|
||||||
within ".map-location" do
|
within ".map-location" do
|
||||||
expect(page).to have_css(".map-icon")
|
expect(page).to have_css ".map-icon"
|
||||||
|
expect(page).not_to have_css ".map-icon[aria-label]"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -274,14 +275,15 @@ shared_examples "mappable" do |mappable_factory_name, mappable_association_name,
|
|||||||
set_arguments(arguments, mappable, mappable_path_arguments)
|
set_arguments(arguments, mappable, mappable_path_arguments)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should display map and marker on #{mappable_factory_name} show page" do
|
scenario "Should display marker on #{mappable_factory_name} show page with aria label" do
|
||||||
arguments[:id] = mappable.id
|
arguments[:id] = mappable.id
|
||||||
|
mappable.update!(title: "Malformed quote\" and >")
|
||||||
|
|
||||||
do_login_for user, management: management if management
|
do_login_for user, management: management if management
|
||||||
visit send(mappable_show_path, arguments)
|
visit send(mappable_show_path, arguments)
|
||||||
|
|
||||||
within ".map-location" do
|
within ".map-location" do
|
||||||
expect(page).to have_css(".map-icon")
|
expect(page).to have_css ".map-icon[aria-label='#{mappable.title}']"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -193,6 +193,8 @@ describe "Ballots" do
|
|||||||
expect(page).to have_content "OpenStreetMap"
|
expect(page).to have_content "OpenStreetMap"
|
||||||
expect(page).to have_content "New Block"
|
expect(page).to have_content "New Block"
|
||||||
expect(page).to have_css ".map-icon", visible: :all, count: 2
|
expect(page).to have_css ".map-icon", visible: :all, count: 2
|
||||||
|
expect(page).to have_css ".map-icon[aria-label='More bridges']", visible: :all
|
||||||
|
expect(page).to have_css ".map-icon[aria-label='Less bridges']", visible: :all
|
||||||
end
|
end
|
||||||
|
|
||||||
add_to_ballot("More bridges")
|
add_to_ballot("More bridges")
|
||||||
|
|||||||
Reference in New Issue
Block a user