Überprüfen Sie, ob das untergeordnete Element Focusd ist

var focused = document.hasFocus();
Selfish Snake