splide
splide copied to clipboard
Visibility returns true if display: none
Checks
- [X] Not a duplicate.
- [X] Not a question, feature request, or anything other than a bug report directly related to Splide. Use Discussions for these topics: https://github.com/Splidejs/splide/discussions
Version
4.0.7
Description
If you append a slideshow into an element that has a style with "display: none" then both the trackRect and slideRect return all 0 values. The return calculation in isVisible() [Slide.ts] will return TRUE even though the slide is hidden due to the ancestor's "display: none" style. Maybe there should be a check to determine if the trackRect is valid (values > 0) and returning false if not.
Reproduction Link
https://codepen.io/jfledd/pen/bGLzgbP
Steps to Reproduce
- Setup basic Splide gallery
- Set wrapper display to 'none'
- Add event listener to see visible/hidden slide states
- All slides will show as visible
Expected Behaviour
Slides not set to visible when parent is display: "none"