Skip to content

Commit

Permalink
refactor (accessibility) : LIGHTBOX correctifs (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
codexarama committed Jun 10, 2021
1 parent 482fc70 commit 27d9658
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions js/lightbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,21 @@ const displayLightbox = () => {
window.location.hash = medias[i].title + ', closeup view';
// affiche media + titre dans lightbox
video.src = selectedMedia.src;
video.alt = medias[i].title + ', closeup view';
lightboxTitle.textContent = medias[i].title;
video.alt = selectedMedia.alt;
lightboxTitle.textContent = "Image extraite de la vidéo";
} else {
// remplace video elmt par img elemt
video.replaceWith(lightboxMedia);
}
// ACCESSIBILITE
// focus sur titre media
lightboxTitle.style.outline = 'none';
lightboxTitle.style.border = '0 0 0 4px #901c1c';
lightboxTitle.focus();
// NE FONCTIONNE PAS ------------------------------------------------------------------------
// navigation entre les medias avec fleches
// window.addEventListener('keydown', (event) => {
// if (event.keyCode === 37) prev.click();
// if (event.keyCode === 39) next.click();
// });
};

// AFFICHE MEDIA PRECEDENT
Expand All @@ -122,9 +126,7 @@ const displayLightbox = () => {
// ACCESSIBILITE
// navigation entre les medias avec fleches
window.addEventListener('keydown', (event) => {
if (event.keyCode === 37) {
prev.click();
}
if (event.keyCode === 37) prev.click();
});
};

Expand All @@ -149,9 +151,7 @@ const displayLightbox = () => {
// ACCESSIBILITE
// navigation entre les medias avec fleches
window.addEventListener('keydown', (event) => {
if (event.keyCode === 39) {
next.click();
}
if (event.keyCode === 39) next.click();
});
};
}
Expand Down

0 comments on commit 27d9658

Please sign in to comment.