You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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, the canClipContent is incorrectly assessed. That element has a default position: static, thus does not affect the visibility of the button. However, this is not checked in the canClipContent, resulting in the incorrectly assessed visibility via calculating the button's position compared to that div.
@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 Element.checkVisibility (chromium feature description: https://chromestatus.com/feature/5163102852087808), which has been widely adopted in other frameworks (i.e. Playwright) and is supported in all modern browsers.
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.
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: