Carousel
2 Carousel variations from the W3C ARIA Authoring Practices Guide.
Carousel (Prev/Next Buttons)
A three-slide image carousel has previous/next buttons and a rotation control first in reading order. Rotation stops on focus or hover and restarts only on explicit request. Reduced-motion preferences pause initial rotation.
Example
Keyboard interaction
Tab visits the rotation and navigation buttons and the visible slide link. Enter or Space activates a button. Hidden slides cannot receive focus. Start automatic slide show explicitly resumes rotation.
Events
Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.
axxy-carousel-change— Dispatched when the active slide changes or automatic rotation starts/stops. (target:Carousel container, detail:{ index: number, slide: HTMLElement, running: boolean })
Example HTML
<axxy-scope>
<section aria-roledescription="carousel" aria-label="Museum highlights">
<button type="button">Stop automatic slide show</button>
<button type="button">Previous slide</button>
<button type="button">Next slide</button>
<div>
<div >
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20480%20180%22%3E%3Crect%20width%3D%22480%22%20height%3D%22180%22%20fill%3D%22%23005a70%22%2F%3E%3Ccircle%20cx%3D%22240%22%20cy%3D%2270%22%20r%3D%2235%22%20fill%3D%22white%22%2F%3E%3Ctext%20x%3D%22240%22%20y%3D%22145%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%20font-family%3D%22sans-serif%22%20font-size%3D%2224%22%3ECraft%20and%20clay%3C%2Ftext%3E%3C%2Fsvg%3E" alt="Craft and clay exhibition illustration" width="480" height="180" style="max-width:100%;height:auto">
<h3>
<a href="#highlight-0">Craft and clay</a>
</h3>
<p id="highlight-0">Explore this museum highlight at your own pace.</p>
</div>
<div hidden>
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20480%20180%22%3E%3Crect%20width%3D%22480%22%20height%3D%22180%22%20fill%3D%22%23623577%22%2F%3E%3Ccircle%20cx%3D%22240%22%20cy%3D%2270%22%20r%3D%2235%22%20fill%3D%22white%22%2F%3E%3Ctext%20x%3D%22240%22%20y%3D%22145%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%20font-family%3D%22sans-serif%22%20font-size%3D%2224%22%3ELight%20and%20colour%3C%2Ftext%3E%3C%2Fsvg%3E" alt="Light and colour exhibition illustration" width="480" height="180" style="max-width:100%;height:auto">
<h3>
<a href="#highlight-1">Light and colour</a>
</h3>
<p id="highlight-1">Explore this museum highlight at your own pace.</p>
</div>
<div hidden>
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20480%20180%22%3E%3Crect%20width%3D%22480%22%20height%3D%22180%22%20fill%3D%22%23346527%22%2F%3E%3Ccircle%20cx%3D%22240%22%20cy%3D%2270%22%20r%3D%2235%22%20fill%3D%22white%22%2F%3E%3Ctext%20x%3D%22240%22%20y%3D%22145%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%20font-family%3D%22sans-serif%22%20font-size%3D%2224%22%3EPatterns%20in%20nature%3C%2Ftext%3E%3C%2Fsvg%3E" alt="Patterns in nature exhibition illustration" width="480" height="180" style="max-width:100%;height:auto">
<h3>
<a href="#highlight-2">Patterns in nature</a>
</h3>
<p id="highlight-2">Explore this museum highlight at your own pace.</p>
</div>
</div>
</section>
</axxy-scope>Carousel (Tablist)
A carousel uses a tablist to choose slides directly. Selected tabs, labelled panels, hidden content, live announcements, and rotation controls stay synchronized. Reduced-motion preferences pause initial rotation.
Example
Keyboard interaction
Tab enters the selected tab. Left/Right, Home and End select slides and move tab focus. Enter or Space activates native buttons. Focus or hover stops rotation; the rotation button explicitly restarts it.
Events
Listen on the widget or delegate to <axxy-scope> or document. All custom events bubble.
axxy-carousel-change— Dispatched when the active slide changes or automatic rotation starts/stops. (target:Carousel container, detail:{ index: number, slide: HTMLElement, running: boolean })
Example HTML
<axxy-scope>
<section aria-roledescription="carousel" aria-label="Museum highlights">
<button type="button">Stop automatic slide show</button>
<div role="tablist" aria-label="Choose a highlight">
<button type="button">1: Craft and clay</button>
<button type="button">2: Light and colour</button>
<button type="button">3: Patterns in nature</button>
</div>
<div>
<div >
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20480%20180%22%3E%3Crect%20width%3D%22480%22%20height%3D%22180%22%20fill%3D%22%23005a70%22%2F%3E%3Ccircle%20cx%3D%22240%22%20cy%3D%2270%22%20r%3D%2235%22%20fill%3D%22white%22%2F%3E%3Ctext%20x%3D%22240%22%20y%3D%22145%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%20font-family%3D%22sans-serif%22%20font-size%3D%2224%22%3ECraft%20and%20clay%3C%2Ftext%3E%3C%2Fsvg%3E" alt="Craft and clay exhibition illustration" width="480" height="180" style="max-width:100%;height:auto">
<h3>
<a href="#highlight-0">Craft and clay</a>
</h3>
<p id="highlight-0">Explore this museum highlight at your own pace.</p>
</div>
<div hidden>
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20480%20180%22%3E%3Crect%20width%3D%22480%22%20height%3D%22180%22%20fill%3D%22%23623577%22%2F%3E%3Ccircle%20cx%3D%22240%22%20cy%3D%2270%22%20r%3D%2235%22%20fill%3D%22white%22%2F%3E%3Ctext%20x%3D%22240%22%20y%3D%22145%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%20font-family%3D%22sans-serif%22%20font-size%3D%2224%22%3ELight%20and%20colour%3C%2Ftext%3E%3C%2Fsvg%3E" alt="Light and colour exhibition illustration" width="480" height="180" style="max-width:100%;height:auto">
<h3>
<a href="#highlight-1">Light and colour</a>
</h3>
<p id="highlight-1">Explore this museum highlight at your own pace.</p>
</div>
<div hidden>
<img src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20480%20180%22%3E%3Crect%20width%3D%22480%22%20height%3D%22180%22%20fill%3D%22%23346527%22%2F%3E%3Ccircle%20cx%3D%22240%22%20cy%3D%2270%22%20r%3D%2235%22%20fill%3D%22white%22%2F%3E%3Ctext%20x%3D%22240%22%20y%3D%22145%22%20text-anchor%3D%22middle%22%20fill%3D%22white%22%20font-family%3D%22sans-serif%22%20font-size%3D%2224%22%3EPatterns%20in%20nature%3C%2Ftext%3E%3C%2Fsvg%3E" alt="Patterns in nature exhibition illustration" width="480" height="180" style="max-width:100%;height:auto">
<h3>
<a href="#highlight-2">Patterns in nature</a>
</h3>
<p id="highlight-2">Explore this museum highlight at your own pace.</p>
</div>
</div>
</section>
</axxy-scope>