]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: listen for the enter key and trigger a change to emulate change event in IE
authorDaniel Ruf <daniel@daniel-ruf.de>
Thu, 29 Mar 2018 19:08:13 +0000 (21:08 +0200)
committerDaniel Ruf <daniel@daniel-ruf.de>
Thu, 29 Mar 2018 19:10:22 +0000 (21:10 +0200)
js/foundation.slider.js

index 48818c26f152f23695180ad472a79cfbf88a41a9..67dfeb8d08b2967715fe253568b22a10a9c51062 100644 (file)
@@ -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());