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

Cypress incorrectly uses the box model of elements that have display:contents when determining visibility of child elements #29605

Open
cacieprins opened this issue Jun 3, 2024 · 0 comments · May be fixed by #29680

Comments

@cacieprins
Copy link
Contributor

cacieprins commented Jun 3, 2024

Current behavior

Elements that have overflow:hidden and an effective width or height of 0, but are set to display: contents, will incorrectly be determined as not visible.

Desired behavior

Cypress should correctly disregard any calculations regarding the box model of elements that have display: contents, as. these elements are effectively replaced by their children. See: https://drafts.csswg.org/css-display/#valdef-display-contents

Test code to reproduce

With the DOM:

<div id="parent" style="overflow: hidden; height: 0; width: 0; display: contents;">
    <div id="child" style="height:200px; width: 200px; background: #f00"></div>
</div>

Cypress wil determine that #child is not visible:

cy.get('#child').should('be.visible') // this will fail due to overflow:hidden and effective 0 width and/or height, despite display: contents

However, this element is clearly visible, as the browser effectively replaces the #parent element with #child when rendering.

Cypress Version

13.11.0

Node version

v18.17.1

Operating System

macOS 14.3

Debug Logs

No response

Other

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants