A slideshow is a scrollable content panel that fits into a small space.
They generally include a system of pagination, navigation arrows, and/or a system for pausing or advancing the content in the case of a slideshow with automatic scrolling.
With regards to accessibility, two types of slideshow can be distinguished:
An example of the basic HTML code for both types of slideshow is shown below. This code should be modified according to the context, especially with respect to the content of the panels.
<ul id="slideshow"> <li class="panel" id="panel-1"> Content of panel 1. </li> <li class="panel" id="panel-2"> Content of panel 2. </li> <li class="panel" id="panel-3"> Content of panel 3. </li> </ul>
Without JavaScript, all the panels are displayed.
The recommendations to follow when writing the JavaScript code will vary according to whether you require an automatic scrolling slideshow or not.
The scripts must handle the following points:
title
of this element changes dynamically according to whether the slideshow is paused or scrolling.position: absolute;
and left: -999999px;
. They are not hidden with display: none;
.tabindex=“0”
, or delete the tabindex
attribute on all the interactive elements contained in the panel (links, buttons, form fields, etc.). tabindex=”-1”
is applied on all the interactive elements contained in these panels. The resulting code with JavaScript is as follows:
<button id="pause-play">Pause</button> <ul id="slideshow"> <li class="panel" id="panel-1"> Content of panel 1 (hidden) with <a href="#" tabindex="-1">a link</a>. </li> <li class="active-panel panel" id="panel-2"> Content of panel 2 with <a href="#">a link</a>. </li> <li class="panel" id="panel-3"> Content of panel 3 (hidden) with <button tabindex="-1">a button </button>. </li> </ul>
This code should be modified according to the context, especially if the pause button is an image. You would then need a code similar to this:
<button id="pause-play"><img src="images/pause.png" alt="Pause" /></button>
The pausing system (in this case, the “Play/Pause” button) must always be inserted in the DOM before the elements it interacts with, whatever its position on the screen.
The scripts must handle the following points:
display: none;
.The resulting code in JavaScript is as follows:
<button id="previous">Previous</button> <ul id="slideshow"> <li class="panel" id="panel-1"> Content of panel 1 (hidden). </li> <li class="active-panel panel" id="panel-2"> Content of panel 2. </li> <li class="panel" id="panel-3"> Content of panel 3 (hidden). </li> </ul> <button id="next">Next</button>
This code should be modified according to the context, especially if the “Previous” and “Next” buttons are images. In this case you need a code similar to the one below:
<code html> <button id=“previous”><img src=“images/previous.png” alt=“Previous” /></button>
[…]
<button id=“next”><img src=“images/next.png” alt=“Next” /></button>
Démonstration à venir.