Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax visibility rules when an element is clipped but can be scrolled to #879

Closed
brian-mann opened this issue Nov 6, 2017 · 1 comment
Closed

Comments

@brian-mann
Copy link
Member

brian-mann commented Nov 6, 2017

I believe the offending logic is here:

https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/dom/visibility.coffee#L135

Currently we define visibility as an element that "could" be seen or interacted with by a user (even if its not currently in the viewport)

This is a "lax" check to avoid needing to scroll the viewport in order to determine an elements visibility (since this is a mutation).

I don't think it makes sense given that rule that we consider an element hidden if its within a container (other than window) that has to be scrolled first.

It seems we do it 1 way and then another way differently. That's confusing.

My suggestion is to relax visibility rules to account for the situation that if an element could be otherwise scrolled to from within a container with scroll, that we consider it visible.

I think as a general rule of thumb we should err on the side "thinking an element is visible when its not" vs "thinking an element is hidden when its not".

@jennifer-shehane
Copy link
Member

We've since made decisions concerning visibility to address this issue. We consider an element visible only if it can be seen within the current viewport and offer the commands to scrollTo() or scrollIntoView() if you want to check their visibility.

Furthermore there is an issue opened to change the scroll behavior, so we will close this issue in favor of that. #871

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants