JSFiddle - React, Tailwind, and code Playground

HTML

<button id="thebutton">Button
</button>

JavaScript

window.addEventListener('keypress', e => console.log('keypress:', e.key))
document.querySelector('#thebutton').focus();
document.querySelector('#thebutton').disabled = true;
console.log('Active element:', document.activeElement.constructor.name);