Optimized the focus event handle