What is role="listbox" used when creating carousel?

JustStartedStudying picture JustStartedStudying · Sep 16, 2016 · Viewed 11.4k times · Source

Just a simple question

When I tried to create a carousel, I noticed many sample codes are:

<div class="carousel-inner" role="listbox">

In the above code, what does role="listbox" do? Please give me an insight.

Answer

Nate K picture Nate K · Sep 16, 2016

role="listbox" is used for accessibility purposes. It identifies to a screen-reader or other assistive technology device that this is an element that allows a user to choose one or more options, such as images in a carousel.

You should also add role="option" to each slide.

see here for more information: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_listbox_role