From edf6f79ff4c1ec20345990467ca3fe2e03b350ec Mon Sep 17 00:00:00 2001 From: Daniel Ruf Date: Thu, 29 Mar 2018 21:08:13 +0200 Subject: [PATCH] fix: listen for the enter key and trigger a change to emulate change event in IE --- js/foundation.slider.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/foundation.slider.js b/js/foundation.slider.js index 48818c26f..67dfeb8d0 100644 --- a/js/foundation.slider.js +++ b/js/foundation.slider.js @@ -460,6 +460,16 @@ class Slider extends Plugin { curHandle, timer; + // IE only triggers the change event when the input loses focus which strictly follows the HTML specification + // listen for the enter key and trigger a change + // @see https://html.spec.whatwg.org/multipage/input.html#common-input-element-events + this.inputs.off('keyup.zf.slider').on('keyup.zf.slider', function (e) { + if(e.keyCode == 13) { + var idx = _this.inputs.index($(this)); + _this._handleEvent(e, _this.handles.eq(idx), $(this).val()); + } + }); + this.inputs.off('change.zf.slider').on('change.zf.slider', function(e) { var idx = _this.inputs.index($(this)); _this._handleEvent(e, _this.handles.eq(idx), $(this).val()); -- 2.47.2