ST: detection of when element is visible fix + unit tests.