JSFiddle - React, Tailwind, and code Playground

HTML

<body>
<button onclick="$('.popup').show();return false;">show popup</button><br>

    <div class="popup">
        <input type="text" name="t1" value="foo"></input>
        <input type="text" name="t2" value="bar"></input>
    </div>   
    <input type="text" name="outside" value="baz"></input>
</body>

CSS

.popup {
    background-color: #ccc;
    padding:5pt;
    display:none;
}

JavaScript

//$(document).ready(function() {
    $('body').focusin(function() {
        $('.popup').hide(); 
    });
    $('.popup').focusin(function(ev) {
        ev.stopPropagation()
    });
//});