Splidejs / splide

Splide is a lightweight, flexible and accessible slider/carousel written in TypeScript. No dependencies, no Lighthouse errors.
https://splidejs.com
MIT License
4.89k stars 424 forks source link

Accessibility : the image shrinks with figure/figcaption (and container does not solve the problem) #1133

Closed Equipement closed 1 year ago

Equipement commented 1 year ago

Checks

Version

v4.1.4

Description

Hello, With a basic Carousel (like https://splidejs.com/tutorials/image-carousel/), if i use figure/figcaption for the caption (for accessibility), the image shrinks.

<div class="splide__slide__container"> <figure ...> <img src="images/01.jpg" alt="Text alternative ..."> <figcaption>Legend of the image ...</figcaption>
</figure> </div>

If i add slide container (https://splidejs.com/guides/structure/#slide-container) the image shrinks, because container is not a direct child of the splide__slide element.

<div class="splide__slide__container"> <figure ...> <div class="splide__slide__container"> <img src="images/01.jpg" alt="Text alternative ..."> </div> <figcaption>Legend of the image ...</figcaption>
</figure> </div>

Thank you in advance for your answer. Best regards.

Reproduction Link

No response

Steps to Reproduce

Steps to reproduce are in the description.

Expected Behaviour

Be able to use figures/figcaptions for the caption (for accessibility), without shrinking the image.

Equipement commented 1 year ago

Seems like browsers often adds a margin to figure tag (cf. www.w3schools.com/cssref/css_default_values.php). With this CSS code, the image don't shrinks : figure {margin:0}