From 81c5477f1d9ac2539e4ec50ede7886abe50fa75a Mon Sep 17 00:00:00 2001 From: Albin Larsson Date: Thu, 21 Jun 2018 15:22:30 +0200 Subject: [PATCH] Fix captions.toggle() if there is no toggle button --- src/js/captions.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/js/captions.js b/src/js/captions.js index 732b2e38..9dca5505 100644 --- a/src/js/captions.js +++ b/src/js/captions.js @@ -191,8 +191,10 @@ const captions = { return; } - // Toggle state - this.elements.buttons.captions.pressed = active; + // Toggle button if it's enabled + if (this.elements.buttons.captions) { + this.elements.buttons.captions.pressed = active; + } // Add class hook toggleClass(this.elements.container, activeClass, active);