JSFiddle - React, Tailwind, and code Playground

HTML

<div id="clickable">
  <iframe src="http://www.google.com"></iframe>
</div>

JavaScript

$(window).focus();

$("#clickable").mouseenter(function(e){
  isOverElement = e.currentTarget.id;
});

$("#clickable").mouseleave(function(e){
  isOverElement = false;
});

$(window).blur(function(e){
  windowLostBlur();
});

function windowLostBlur() 
{
  if (isOverElement) 
  {
    alert(isOverElement);
    $(window).focus();
  }
};