OGE logoOGE

Carousel

oge-carousel is a slide show — an image gallery, a hero banner, a product row — with previous / next buttons, a dot or thumbnail picker, looping and auto-rotation.

It follows the WAI-ARIA APG carousel pattern: a region with aria-roledescription="carousel", slides named "2 of 5", the off-screen slides inert, a tab-list picker with one slide per view and a button row with several. Rotation pauses on hover, stops when keyboard focus enters, and always has a visible rotation control (WCAG 2.2.2). The track is a scroll-snap container moved by script and by swipes on the shared pointer gesture, so touch, mouse and RTL all land on whole slides.

APG carousel swipe autoplay thumbnails RTL

Basics

Data-driven slides draw an image and a frosted caption. The previous / next buttons are aria-disabled at the ends (they keep focus), the dots are an APG tab list (arrow keys, Home, End — mirrored in RTL), and a swipe or a mouse drag lands on the nearest slide past a fifth of its width.

items selectedIndex ariaLabel height

Showing slide 1

Thumbnails & loop

indicators="thumbnails" draws a scrollable strip of decorative thumbnails — each tab is still named “Slide 2”. loop wraps the buttons, the picker keys and swipes from the last slide back to the first; the carousel rewinds rather than cloning slides, so assistive technology always sees the real count.

indicators: thumbnails loop

Autoplay & rotation control

The rotation control is rendered first and always visible. Hovering pauses the rotation, a hidden tab holds it, and keyboard focus entering the carousel stops it until the user presses play — the APG rule. While it rotates the slides are aria-live="off"; once stopped, polite. Under prefers-reduced-motion it starts stopped.

autoplay autoplayInterval play() pause()

No events yet

Several slides per view

With slidesPerView above one the picker becomes the APG grouped carousel's row of buttons — one per reachable position, the current one aria-current — because a dot no longer maps to one slide. [ogeCarouselSlideTemplate] replaces the image and caption; its context says whether the slide is in view.

slidesPerView gap ogeCarouselSlideTemplate

Declarative slides

<oge-carousel-slide> children project any content and render before the items slides. Their label names the slide (“Version 1.3, 1 of 3”). Off-screen slides are inert, so the link in a hidden slide never takes a Tab stop.

oge-carousel-slide label projected content