adds check for element visibility