JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test" style="width:100px; height:100px; background-color:#ff0000" tabindex="0"></div>
JavaScript
var el = document.getElementById("test");
el.onmouseover = function() this.focus();
el.onmouseout = function() this.blur();
el.onfocus = function() {
this.onkeydown = function(e) alert(e.keyCode);
};