-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
"isVisible" is incorrectly assessed for the absolutely positioned elements if the ancestor has overflow and static position #28638
Comments
@klarzynskik We would be open to accepting a PR to update our visibility algorithm to address this. The code for visibility is here: https://github.com/cypress-io/cypress/blob/develop/packages/driver/src/dom/visibility.ts |
@jennifer-shehane, thanks for the reply! Indeed, I was already looking into that, and it seems that the most straightforward option would be to move to the native Would you be open to such a refactor? I would be happy to work on that. |
@klarzynskik Yes! I had spent about 20 minutes trying to throw this check in place of our visibility checks one day and some of our tests were failing, but I didn't have time to investigate further. As long as our current visibility tests all pass - any updates and refactors are welcome, especially if they address any of the outstanding visibility issues with added tests and do not impact performance negatively. |
I checked in my version and seems like: |
@senpl Thanks, I'll note that in the PR for us to verify also. |
I already did that refactor in #29741 . But your comment make me aware of this solution. |
Current behavior
It appears "isVisible" is incorrectly assessed for the absolutely positioned elements if the ancestor has an overflow and static position. For example, for the following document the
#visible-button
is considered as not-visible:Here's the screenshot from the test:
It appears that in this case, while assessing the
isVisible
, the button goes particularly into the isHidddenByAncestors. Then while calculating the elIsOutOfBoundsOfAncestorsOverflow for the#breaking-container
div element from the example, thecanClipContent
is incorrectly assessed. That element has a defaultposition: static
, thus does not affect the visibility of the button. However, this is not checked in thecanClipContent
, resulting in the incorrectly assessed visibility via calculating the button's position compared to that div.The documentation in that particular states that:
However, as mentioned above, I think that this should be true only if the considered ancestor's position is not static.
Desired behavior
Element visibility is correctly assessed.
Test code to reproduce
Here's the repository: https://github.com/klarzynskik/cypress-visibility-issue-demo
The simplest example is the following code:
Cypress Version
13.6.2
Node version
18.16.1
Operating System
macOS 13.4.1
Debug Logs
No response
Other
No response
The text was updated successfully, but these errors were encountered: