IMPR: Carousel accesability attributes

This commit is contained in:
Tony Air 2021-08-02 23:26:46 +02:00
parent 9df78276e9
commit c0d4f554ff
1 changed files with 75 additions and 72 deletions

View File

@ -14,6 +14,7 @@ const CarouselUI = ((window) => {
const next = document.createElement('button');
next.classList.add('carousel-control-next');
next.setAttribute('type', 'button');
prev.setAttribute('aria-label', 'Next Slide');
next.setAttribute('data-bs-target', el.getAttribute('id'));
next.setAttribute('data-bs-slide', 'next');
next.addEventListener('click', (e) => {
@ -24,6 +25,7 @@ const CarouselUI = ((window) => {
const prev = document.createElement('button');
prev.setAttribute('type', 'button');
prev.setAttribute('aria-label', 'Previous Slide');
prev.classList.add('carousel-control-prev');
prev.setAttribute('data-bs-target', el.getAttribute('id'));
prev.setAttribute('data-bs-slide', 'prev');
@ -42,6 +44,7 @@ const CarouselUI = ((window) => {
while (i < items.length) {
const ind = document.createElement('button');
ind.setAttribute('type', 'button');
ind.setAttribute('aria-label', 'Slide to #' + (i + 1));
if (i == 0) {
ind.classList.add('active');
}