JS Accessibility refinement
This commit is contained in:
parent
a4ddfd609d
commit
6cc0d1c1ad
4 changed files with 53 additions and 19 deletions
|
@ -14,16 +14,29 @@ function onlyPlayOneIn(container) {
|
|||
);
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
onlyPlayOneIn(document.body);
|
||||
});
|
||||
function renderJSButtons() {
|
||||
// If JS is disabled this won't run and therefore JS-powered buttons won't be displayed
|
||||
let blockToggle = document.getElementsByClassName("block-toggle");
|
||||
for (let i = 0; i < blockToggle.length; i++) {
|
||||
blockToggle[i].style.display = "block";
|
||||
// Accessibility is important!!!
|
||||
blockToggle[i].ariaHidden = "false";
|
||||
}
|
||||
}
|
||||
|
||||
function blockToggle(id) {
|
||||
var blockID = document.getElementById(id);
|
||||
|
||||
if (blockID.style.display === "block") {
|
||||
blockID.style.display = "none";
|
||||
blockID.ariaHidden = "true";
|
||||
} else {
|
||||
blockID.style.display = "block";
|
||||
blockID.ariaHidden = "false";
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
onlyPlayOneIn(document.body);
|
||||
renderJSButtons();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue