From 21565f635e284696424ca8a626a97d702cd0bb05 Mon Sep 17 00:00:00 2001 From: saqimtiaz Date: Fri, 3 Apr 2020 14:07:55 +0200 Subject: [PATCH] Fix range widget for IE10/11 (#4534) As detailed in #4519 the range widget currently does not save its value to the state tiddler on IE 10/11 as they do not support the input event, but rather the change event is fired instead of the input event. This has patch has been tested in IE11 and should work in IE10 as well. Note that on Chrome and Firefox, the change event will fire only once after the user stops dragging the range slider (In addition the input event). However this does lead to an extra refresh as the handleInputEvent method already checks to see if the current value of the slider is different from the saved value before saving to the store. --- core/modules/widgets/range.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/modules/widgets/range.js b/core/modules/widgets/range.js index d5ab2c785..0d899e891 100644 --- a/core/modules/widgets/range.js +++ b/core/modules/widgets/range.js @@ -49,7 +49,8 @@ RangeWidget.prototype.render = function(parent,nextSibling) { this.inputDomNode.value = this.getValue(); // Add a click event handler $tw.utils.addEventListeners(this.inputDomNode,[ - {name: "input", handlerObject: this, handlerMethod: "handleInputEvent"} + {name: "input", handlerObject: this, handlerMethod: "handleInputEvent"}, + {name: "change", handlerObject: this, handlerMethod: "handleInputEvent"} ]); // Insert the label into the DOM and render any children parent.insertBefore(this.inputDomNode,nextSibling); @@ -124,4 +125,4 @@ RangeWidget.prototype.refresh = function(changedTiddlers) { exports.range = RangeWidget; -})(); \ No newline at end of file +})();