Flip Through a Carousel
Write the code, see it run, pass the checks.
The problem
- easy
- Code
Build a carousel that shows one slide at a time. The slides prop is a list of { title, text } objects (the starter has four). Show only the current slide: its title in an h3 heading and its text in a paragraph (leave the others out, or hide them with the hidden attribute). Below it, a line reads like "Slide 2 of 4". A "Next" button moves to the next slide and a "Previous" button to the one before, wrapping round: Next on the last slide goes to the first, and Previous on the first to the last. Wrap it all in a section with aria-label="Highlights" (a labelled section is a region landmark) and aria-roledescription="carousel", so screen readers announce what it is.
Your code must pass
- Shows the first slide and "Slide 1 of 3" at first
- Next and Previous move between slides
- Next on the last slide wraps to the first, and Previous on the first to the last
- The carousel is a region named "Highlights", described as a carousel