From 62b6e6d3190d760a220fc19d9ced9871bca95085 Mon Sep 17 00:00:00 2001 From: Stephan Bruijnis Date: Fri, 18 Aug 2017 16:07:04 +0200 Subject: [PATCH] Change eventlistner to act on touchstart Fix for iOS8 (iPhone 5/6) In the old situation a double tap on the dropzone was required to open the file explorer on iOS8 devices (the first one was probably interpreted as an hover). This commit adds the touchstart, now a single tap on the dropzone in iOS8 should open the file explorer. --- src/DropZone/widget/lib/dropzone.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/DropZone/widget/lib/dropzone.js b/src/DropZone/widget/lib/dropzone.js index 25ec3a4..e22b032 100644 --- a/src/DropZone/widget/lib/dropzone.js +++ b/src/DropZone/widget/lib/dropzone.js @@ -686,7 +686,19 @@ _this.hiddenFileInput.click(); } return true; - } + }, + /* + // scb fix for iOS8 + // it was supposed to be fixed in https://github.com/enyo/dropzone/issues/935 release 4.1.1 + // yet in 4.3.0 it doesn't work anymore so I added the touchstart and stopPropagation + */ + "touchstart": function(evt) { + evt.stopPropagation(); + if ((clickableElement !== _this.element) || (evt.target === _this.element || Dropzone.elementInside(evt.target, _this.element.querySelector(".dz-message")))) { + _this.hiddenFileInput.click(); + } + return true; + } } }); }; @@ -1780,4 +1792,4 @@ }).call(this); return module.exports; -})); \ No newline at end of file +}));