nuka-carousel
nuka-carousel copied to clipboard
Height is incorrect when there is only one element
Caused by the lines below: https://github.com/react-component/nuka-carousel/blob/f36d0624bd8acdf5caabf949d1380db4e6a39f0f/src/carousel.tsx#L313-L315 https://github.com/react-component/nuka-carousel/blob/f36d0624bd8acdf5caabf949d1380db4e6a39f0f/src/carousel.tsx#L810
When there is only one child, say <div style="height: 100px"></div>, the DOM structure becomes:
<ul>
<div style="height: auto"></div>
</ul>
Note that the height of <div> is incorrectly set to auto, so it does not work. In this case the height becomes 0px and nothing is shown.
When there are more than one children, it works because the styles of children are kept:
<ul>
<li style="height: auto">
<div style="height: 100px"></div>
</li>
<li>
<div style="height: 100px"></div>
</li>
</ul>