better focus event handling