Skip to content

Commit

Permalink
added option to enable focus on slideChange
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Westneat committed Aug 4, 2017
1 parent 038f84e commit 729dcd4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions slick/slick.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
edgeFriction: 0.35,
fade: false,
focusOnSelect: false,
focusOnChange: false,
infinite: true,
initialSlide: 0,
lazyLoad: 'ondemand',
Expand Down Expand Up @@ -1089,7 +1090,7 @@
if (_.slideCount > _.options.slidesToShow) {
_.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
coef = -1

if (_.options.vertical === true && _.options.centerMode === true) {
if (_.options.slidesToShow === 2) {
coef = -1.5;
Expand Down Expand Up @@ -1318,7 +1319,7 @@
'role': 'tabpanel',
'id': 'slick-slide' + _.instanceUid + i,
'tabindex': -1
});
});

if (slideControlIndex !== -1) {
$(this).attr({
Expand All @@ -1329,7 +1330,7 @@

_.$dots.attr('role', 'tablist').find('li').each(function(i) {
var mappedSlideIndex = tabControlIndexes[i];

$(this).attr({
'role': 'presentation'
});
Expand Down Expand Up @@ -1376,7 +1377,7 @@
if (_.options.accessibility === true) {
_.$prevArrow.on('keydown.slick', _.keyHandler);
_.$nextArrow.on('keydown.slick', _.keyHandler);
}
}
}

};
Expand Down Expand Up @@ -1696,8 +1697,8 @@

if (_.options.accessibility === true) {
_.initADA();
// for non-autoplay: once active slide (group) has updated, set focus on first newly showing slide
if (!_.options.autoplay) {
// for non-autoplay: once active slide (group) has updated, set focus on first newly showing slide
if (_.options.focusOnChange) {
var $currentSlide = $(_.$slides.get(_.currentSlide));
$currentSlide.attr('tabindex', 0).focus();
}
Expand Down

0 comments on commit 729dcd4

Please sign in to comment.