diff --git a/src/assets/js/keyboard-mode.js b/src/assets/js/keyboard-mode.js index 67d0fe9..6deb516 100644 --- a/src/assets/js/keyboard-mode.js +++ b/src/assets/js/keyboard-mode.js @@ -56,13 +56,17 @@ const handleLetterKeyPress = (e) => { } function getCurrentlyVisibleCountries() { + const userName = window.location.href.split("username=")[1]; + let data = script.getCurrentData(); // return an array consiting of objects with the country name in plain text + the index number of the country let formattedCountries = []; visibleCountries.forEach((country) => { + const countryId = parseInt(country.id.slice(1)); const letter = ALPHABET[visibleCountries.indexOf(country)]; formattedCountries.push({ name: utils.getCountryNameFromId(parseInt(country.id.slice(1))), - number: letter + number: letter, + artistCount: data[countryId][userName].length || 0 }); }); return formattedCountries; @@ -354,7 +358,7 @@ function getVisibleCountries(zoom) { let message = "List of countries: "; const countries = getCurrentlyVisibleCountries(); countries.forEach((country) => { - message += `${country.number}: ${country.name}, `; + message += `${country.number}: ${country.name} (${country.artistCount} artists), `; }); announcer.announce(message, "assertive", 100); console.log(message); diff --git a/src/assets/js/script.js b/src/assets/js/script.js index a7ed496..f6a2bca 100644 --- a/src/assets/js/script.js +++ b/src/assets/js/script.js @@ -298,11 +298,7 @@ var countryCountObj = {}; // Screen reader status update every 30 seconds setTimeout(function () { announcer.announce(document.getElementById("loading-text").innerText); - }, 3000); - announcer.announce(document.getElementById("loading-text").innerText); - announcementIntervalId = setInterval(() => { - announcer.announce(document.getElementById("loading-text").innerText); - }, 45000); + }, 6000); setTimeout(function () { if (d3.select("#loading-text").html() === "Getting library...") { @@ -311,7 +307,6 @@ var countryCountObj = {}; if (d3.select("#loading-text").html() === "Last.fm is taking
a long time to
respond...") { d3.select("#loading-text").html("Maybe last.fm has
gone offline...") .style("pointer-events", "all"); - clearInterval(announcementIntervalId); } }, 8000); } @@ -414,10 +409,10 @@ var countryCountObj = {}; // Screen reader status update clearInterval(announcementIntervalId); - announcer.announce("All artists are loaded!"); + announcer.announce("All artists have been loaded!"); const map = document.querySelector("#map-container svg") const existingAriaLabelledBy = map.getAttribute("aria-labelledby"); - map.setAttribute("aria-labelledby", `${existingAriaLabelledBy} progress-text`); + map.setAttribute("aria-labelledby", `${existingAriaLabelledBy} progress-text sr-instructions`); // We're done, fade out loader var loader = d3.select(".loader"); diff --git a/src/assets/js/search.js b/src/assets/js/search.js index b90d230..ffd0232 100644 --- a/src/assets/js/search.js +++ b/src/assets/js/search.js @@ -47,7 +47,7 @@ let filteredShortcuts = []; let announcement = ''; if (announcementParts.length > 0) { - announcement = 'Showing ' + announcementParts.slice(0, -1).join(', ') + (announcementParts.length > 1 ? ' and ' : '') + announcementParts.slice(-1); + announcement = 'Showing ' + announcementParts.slice(0, -1).join(', ') + (announcementParts.length > 1 ? ' and ' : '') + announcementParts.slice(-1) + ', press down arrow to go to results'; } else { announcement = 'No results found'; } diff --git a/src/index.html b/src/index.html index 2db7487..6ce32f0 100644 --- a/src/index.html +++ b/src/index.html @@ -313,6 +313,7 @@

+