mirror of
https://github.com/a2nt/webpack-bootstrap-ui-kit.git
synced 2024-10-22 11:05:45 +02:00
IMPR: Carousel accesability attributes
This commit is contained in:
parent
9df78276e9
commit
c0d4f554ff
@ -14,6 +14,7 @@ const CarouselUI = ((window) => {
|
|||||||
const next = document.createElement('button');
|
const next = document.createElement('button');
|
||||||
next.classList.add('carousel-control-next');
|
next.classList.add('carousel-control-next');
|
||||||
next.setAttribute('type', 'button');
|
next.setAttribute('type', 'button');
|
||||||
|
prev.setAttribute('aria-label', 'Next Slide');
|
||||||
next.setAttribute('data-bs-target', el.getAttribute('id'));
|
next.setAttribute('data-bs-target', el.getAttribute('id'));
|
||||||
next.setAttribute('data-bs-slide', 'next');
|
next.setAttribute('data-bs-slide', 'next');
|
||||||
next.addEventListener('click', (e) => {
|
next.addEventListener('click', (e) => {
|
||||||
@ -24,6 +25,7 @@ const CarouselUI = ((window) => {
|
|||||||
|
|
||||||
const prev = document.createElement('button');
|
const prev = document.createElement('button');
|
||||||
prev.setAttribute('type', 'button');
|
prev.setAttribute('type', 'button');
|
||||||
|
prev.setAttribute('aria-label', 'Previous Slide');
|
||||||
prev.classList.add('carousel-control-prev');
|
prev.classList.add('carousel-control-prev');
|
||||||
prev.setAttribute('data-bs-target', el.getAttribute('id'));
|
prev.setAttribute('data-bs-target', el.getAttribute('id'));
|
||||||
prev.setAttribute('data-bs-slide', 'prev');
|
prev.setAttribute('data-bs-slide', 'prev');
|
||||||
@ -42,6 +44,7 @@ const CarouselUI = ((window) => {
|
|||||||
while (i < items.length) {
|
while (i < items.length) {
|
||||||
const ind = document.createElement('button');
|
const ind = document.createElement('button');
|
||||||
ind.setAttribute('type', 'button');
|
ind.setAttribute('type', 'button');
|
||||||
|
ind.setAttribute('aria-label', 'Slide to #' + (i + 1));
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
ind.classList.add('active');
|
ind.classList.add('active');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user