Trên trang này

Trang này chưa có bản tiếng Việt, nội dung bên dưới là bản tiếng Anh. Xem trang tiếng Anh

Carousel

Keys, what Carousel gives you and what your team does.

Conformance

Carousel meets WCAG 2.2 level AA when used as described on these pages. It follows the Carousel pattern of the WAI-ARIA Authoring Practices, without auto-rotation.

Keyboard

Key Action
Tab Moves to the carousel, then to the controls in the visible slides, then Previous and Next.
← / → Previous or next slide, while the carousel has focus (↑ / ↓ when vertical).
Enter or Space On Previous or Next, moves one slide.
  • role="region" with aria-roledescription="carousel" on the carousel, and role="group" with aria-roledescription="slide" on each slide.
  • The carousel takes focus and shows the focus ring.
  • Previous and Next are buttons with names (“Previous slide”, “Next slide”), disabled at either end.

What your team does

  • Give the carousel an aria-label and each slide an aria-label with its position (“2 of 5”).
  • Translate the button names through their slot in other languages.
  • Leave autoplay off. If it is needed, add a pause button and stop it on hover and focus.
  • Keep controls in hidden slides out of reach: give them tabindex="-1" or inert on slides that are out of view.

WCAG criteria

Criterion Level How
1.3.1 Info and Relationships A Region and slide roles, slide names
2.1.1 Keyboard A Arrow keys and focusable buttons
2.2.2 Pause, Stop, Hide A No auto-rotation
2.4.7 Focus Visible AA Focus ring on the carousel and buttons
4.1.2 Name, Role, Value A Named buttons, disabled at the ends