]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Change slides with arrow keys only if the data-accessible option is true 8942/head
authorDavid Hargitai <dhargitai@sessiondigital.com>
Fri, 17 Jun 2016 16:57:38 +0000 (18:57 +0200)
committerGitHub <noreply@github.com>
Fri, 17 Jun 2016 16:57:38 +0000 (18:57 +0200)
js/foundation.orbit.js

index a0a221c1a4859707f98c0e60d1965833fbffa236..d12f62f6cc94e299a653f70977c1dbb1e5ca3ed8 100644 (file)
@@ -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();
+              }
             }
-          }
+          });
         });
-      });
+      }
     }
   }