From: David Hargitai Date: Fri, 17 Jun 2016 16:57:38 +0000 (+0200) Subject: Change slides with arrow keys only if the data-accessible option is true X-Git-Tag: v6.2.4-rc1~62^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F8942%2Fhead;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Change slides with arrow keys only if the data-accessible option is true --- diff --git a/js/foundation.orbit.js b/js/foundation.orbit.js index a0a221c1a..d12f62f6c 100644 --- a/js/foundation.orbit.js +++ b/js/foundation.orbit.js @@ -216,23 +216,25 @@ class Orbit { _this.changeSlide(ltr, $slide, idx); }); } - - this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function(e) { - // handle keyboard event with keyboard util - Foundation.Keyboard.handleKey(e, 'Orbit', { - next: function() { - _this.changeSlide(true); - }, - previous: function() { - _this.changeSlide(false); - }, - handled: function() { // if bullet is focused, make sure focus moves - if ($(e.target).is(_this.$bullets)) { - _this.$bullets.filter('.is-active').focus(); + + if (this.options.accessible) { + this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function(e) { + // handle keyboard event with keyboard util + Foundation.Keyboard.handleKey(e, 'Orbit', { + next: function() { + _this.changeSlide(true); + }, + previous: function() { + _this.changeSlide(false); + }, + handled: function() { // if bullet is focused, make sure focus moves + if ($(e.target).is(_this.$bullets)) { + _this.$bullets.filter('.is-active').focus(); + } } - } + }); }); - }); + } } }