From c7a153678148865449105f2bfde38f94e278fd33 Mon Sep 17 00:00:00 2001 From: David Hargitai Date: Fri, 17 Jun 2016 18:57:38 +0200 Subject: [PATCH] Change slides with arrow keys only if the data-accessible option is true --- js/foundation.orbit.js | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) 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(); + } } - } + }); }); - }); + } } } -- 2.47.2