Skip to content

Instantly share code, notes, and snippets.

@kevduc
Last active December 10, 2024 20:13
Show Gist options
  • Save kevduc/1eb7207b47bc731d56043ca89482b432 to your computer and use it in GitHub Desktop.
Save kevduc/1eb7207b47bc731d56043ca89482b432 to your computer and use it in GitHub Desktop.
Simple Web Screen Reader v1
document.addEventListener("click", ({ target }) => {
speechSynthesis.cancel();
speechSynthesis.speak(new SpeechSynthesisUtterance(target.textContent));
// animate outline
target.animate({
outline: [
"2px solid rgb(0 0 255 / 100%)",
"5px solid rgb(0 0 255 / 0%)",
],
easing: "ease-out",
}, 500);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment