Skip to content

Commit

Permalink
Ensure focus events aren't stopped propagating to other events. Fixes k…
Browse files Browse the repository at this point in the history
  • Loading branch information
davemacaulay committed Mar 20, 2018
1 parent ee7d37f commit ed0efa1
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions slick/slick.js
Original file line number Diff line number Diff line change
Expand Up @@ -1014,23 +1014,37 @@

var _ = this;

// If any child element receives focus within the slider we need to pause the autoplay
_.$slider
.off('focus.slick blur.slick')
.on('focus.slick blur.slick', '*', function(event) {
.on(
'focus.slick',
'*',
function(event) {
var $sf = $(this);

event.stopImmediatePropagation();
var $sf = $(this);

setTimeout(function() {

if( _.options.pauseOnFocus ) {
_.focussed = $sf.is(':focus');
_.autoPlay();
setTimeout(function() {
if( _.options.pauseOnFocus ) {
if ($sf.is(':focus')) {
_.focussed = true;
_.autoPlay();
}
}
}, 0);
}

}, 0);

});
).on(
'blur.slick',
'*',
function(event) {
var $sf = $(this);

// When a blur occurs on any elements within the slider we become unfocused
if( _.options.pauseOnFocus ) {
_.focussed = false;
_.autoPlay();
}
}
);
};

Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() {
Expand Down

0 comments on commit ed0efa1

Please sign in to comment.