1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-15 22:00:26 +02:00

Fix a few accessibility violations (#2547)

* Add chrome.css and general.css to override default css file. This is
necessary to fix links without underline (hyperlinks relying only on
color).
* Fix pop-out button without id and wrong ARIA-ROLE
* Speaker's notes now at correct heading sequence (H3)
This commit is contained in:
Henri F.
2025-01-15 19:11:19 -08:00
committed by GitHub
parent aa548f4431
commit f95c28f9a7
5 changed files with 970 additions and 8 deletions

View File

@ -95,21 +95,23 @@
let summary = document.createElement("summary");
notes.insertBefore(summary, notes.firstChild);
let h4 = document.createElement("h4");
h4.setAttribute("id", "speaker-notes");
h4.append("Speaker Notes");
h4.addEventListener("click", (event) => {
let h3 = document.createElement("h3");
h3.setAttribute("id", "speaker-notes");
h3.append("Speaker Notes");
h3.addEventListener("click", (event) => {
// Update fragment as if we had clicked a link. A regular a element would
// result in double-fire of the event.
window.location.hash = "#speaker-notes";
});
summary.append(h4);
summary.append(h3);
// Create pop-out button.
let popOutLocation = new URL(window.location.href);
popOutLocation.hash = "#speaker-notes-open";
let popOut = document.createElement("button");
popOut.classList.add("icon-button", "pop-out");
popOut.setAttribute("title", "Open speaker notes in a new window");
popOut.setAttribute("aria-label", "Open speaker notes in a new window");
popOut.addEventListener("click", (event) => {
let popup = window.open(popOutLocation.href, "speakerNotes", "popup");
if (popup) {