Check out example codes for "checked a element is focused with its key pressed". It will help you in understanding the concepts better.

Code Example 1

$(window).keyup(function (e) {
    var code = (e.keyCode ? e.keyCode : e.which);
    if (code == 9 && $('#detect:focus').length) {
        alert('I was tabbed!');
    }
});

Learn ReactJs, React Native from akashmittal.com