️ Add ARIA labels to code copy buttons

pull/100/head
James Panther 2022-01-27 11:39:59 +11:00
parent 734fa6e827
commit cc3960cf2a
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
1 changed files with 1 additions and 0 deletions

View File

@ -6,6 +6,7 @@ function createCopyButton(highlightDiv) {
const button = document.createElement("button"); const button = document.createElement("button");
button.className = "copy-button"; button.className = "copy-button";
button.type = "button"; button.type = "button";
button.ariaLabel = copyText;
button.innerText = copyText; button.innerText = copyText;
button.addEventListener("click", () => copyCodeToClipboard(button, highlightDiv)); button.addEventListener("click", () => copyCodeToClipboard(button, highlightDiv));
addCopyButtonToDom(button, highlightDiv); addCopyButtonToDom(button, highlightDiv);