mreq / slick-lightbox

A lightbox wrapper for Ken's amazing slick carousel.
http://mreq.github.io/slick-lightbox/
MIT License
229 stars 103 forks source link

Opening slick lightbox multiple times on enter keypress #41

Closed adamsbk closed 7 years ago

adamsbk commented 7 years ago

Hi, thank you for sharing slick-lightbox! I used it in the project and working well. However, I noticed some unwanted behaviour: After the slick item (using anchor tags) is clicked, the slick-lightbox appears. Then when there is pressed Enter on the keyboard, the slick-lightbox is opened again. Then It allows to close only the last slick-lightbox. It is caused by focus on the slick item. I handled this behaviour catching the show event and blurring particular anchor tag:

$('#slick-slider').on('show.slickLightbox', function(evt) {
    $(evt.currentTarget).find('a:focus').blur();
});