visible button in a sticky element in a modal is detected as not visible
See original GitHub issueCurrent behavior
I have a button inside a sticky element in a modal. Behind the modal is a scrollable element which is an ancestor of the modal. Cypress thinks that the button is not visible. I get the following error message:
This element
<button#button>
is not visible because its content is being clipped by one of its parent elements, which has a CSS property of overflow:hidden
,scroll
orauto
Here is the screenshot of the failing test:
Desired behavior
I can see the button. Cypress should recognize that it is visible.
Test code to reproduce
I have a simple example which reproduces this error. You can find it here: https://github.com/FraKraBa/cypress-test-tiny
Versions
Cypress 6.4.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Bootstrap modal not displaying
If you're running Bootstrap 4, it may be due to ".fade:not(.show) ... my modal was not showing, and I realized that my button...
Read more >How to Fix Issues With CSS Position Sticky Not Working?
Learn possible reasons why CSS position sticky might not be working for you.
Read more >Sticky side button and hide/show on hero image - Support
Hi, To fix this, kindly do the following. z-index: 9999; Add the code below in the style field of the Row Element where...
Read more >overflow - CSS: Cascading Style Sheets - MDN Web Docs
Overflow options include clipping, showing scrollbars, or displaying the content flowing out of its container into the surrounding area.
Read more >Modal · Bootstrap v5.0
Modals use position: fixed , which can sometimes be a bit particular about its rendering. Whenever possible, place your modal HTML in a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Released in v7.0.0
I debugged a little bit and found the following suspicious function:
In the case presented the button is inside a sticky element. Thus,
elOrAncestorIsFixed
returns false. AfterwardselIsOutOfBoundsOfAncestorsOverflow
is called and tells that the button is not inside its ancestor Details which hasoverflow:scroll
. However, between the button and Details is the modal which hat the propertyposition:fixed
.