Using modern JavaScript APIs

Check if an element has focus

document.activeElement === myElement

Speech synthesis

Use the speechSynthesis API.

Environment

You don't need dotenv anymore since Node 20.6.