question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue rendering a carousel without images

See original GitHub issue

I’ve found a weird bug where the carousel position breaks while swiping on mobile, if there are no images. This issue can be seen in the “basic - no images” storybook example. The css translate3D position percent is way higher than it should be.

A work around I found is to include a small hidden image within the carousel items.

I did a small amount of debugging, and I noticed that the initialized and hasMount state never gets set to true. If these are manually set to true in the constructor, the issue goes away.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6

github_iconTop GitHub Comments

2reactions
Am1tgupt4commented, Jul 9, 2020

Hi Tyler, Josuha I found this weird behaviour as well, In my case I have 3 images and when page first loads and I try to swipe it by touch slide, I see white background and in this case I found that transition3D is set way higher for slider class node and thus image is out of viewport.It makes it a crappy user experience, Did you find a work around for this ?

1reaction
ledbetterljoshuacommented, May 22, 2020

@tylerjlawson I added an image tag to the content of my carousel items. I believe any image will work as long as it resolves. Then I used CSS to hide the image from view.

<Carousel>
   <div>
    ...content
    <img className="hidden" src="/img/favicon.jpg" />
  </div>
</Carousel>

Also just FYI, you may have a different issue, as I do not see any errors in the console.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using an Image Carousel in React, strange rendering issue
Fairly new to React, but I believe the issue may be caused by nesting the Carousel components within the 'About' component. Below is...
Read more >
React-Carousel not renders png formatted images #1636
I have 3 jpg format images and 2 png formatted images in this library, what happens is In carouse is, only shows jpg...
Read more >
Best practices for carousels - web.dev
If two equally sized images are rendered, the first image will be considered the LCP element. The LCP element is only updated when...
Read more >
Carousel issue in SSR rendering - Material Design for Bootstrap
Hi Team, Another issue in carousel because of this issue i am not able to release my website in production. Start your code...
Read more >
Creating an Accessible Image Carousel
Learn how to build an accessible image carousel that supports multiple input modes and is progressively enhanced with CSS scroll snap and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found