splide icon indicating copy to clipboard operation
splide copied to clipboard

Visibility returns true if display: none

Open jsfledd opened this issue 3 years ago • 0 comments

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

  1. Setup basic Splide gallery
  2. Set wrapper display to 'none'
  3. Add event listener to see visible/hidden slide states
  4. All slides will show as visible

Expected Behaviour

Slides not set to visible when parent is display: "none"

jsfledd avatar Jun 14 '22 17:06 jsfledd