added hasfocus method to check if an element is visible in viewport