From cb680cba14c4251b9ad7c7fa92b5d97b46b80779 Mon Sep 17 00:00:00 2001 From: Marco 'Lubber' Wienkoop Date: Thu, 2 Mar 2023 18:00:35 +0100 Subject: [PATCH] fix(slider): also bind events on disabled variant Always bind events even if the initial slider is disabled. This allows to keep the slider intact if the disabled class is removed manually --- src/definitions/modules/slider.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/definitions/modules/slider.js b/src/definitions/modules/slider.js index 7ea9bdb04d..a4e490caa3 100644 --- a/src/definitions/modules/slider.js +++ b/src/definitions/modules/slider.js @@ -103,9 +103,7 @@ module.setup.layout(); module.setup.labels(); - if (!module.is.disabled()) { - module.bind.events(); - } + module.bind.events(); module.read.metadata(); module.read.settings(); @@ -401,6 +399,9 @@ } }, keydown: function (event, first) { + if (module.is.disabled()) { + return; + } if (settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) { $currThumb = undefined; } @@ -437,7 +438,7 @@ } }, activateFocus: function (event) { - if (!module.is.focused() && module.is.hover() && module.determine.keyMovement(event) !== NO_STEP) { + if (!module.is.disabled() && !module.is.focused() && module.is.hover() && module.determine.keyMovement(event) !== NO_STEP) { event.preventDefault(); module.event.keydown(event, true); $module.trigger('focus');