From 8222b41ab6f5017b6ed66559ab76afacede67477 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 28 Jul 2017 12:06:42 +0200 Subject: [PATCH] MOBILE-2178 ionic: Fix keyboard hiding deep input elements --- www/core/main.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/www/core/main.js b/www/core/main.js index 289fb5aef6c..7889fd96dfa 100644 --- a/www/core/main.js +++ b/www/core/main.js @@ -287,11 +287,12 @@ angular.module('mm.core', ['pascalprecht.translate']) } }); - if (!$mmApp.isDevice()) { - // Re-define getParentOrSelfWithClass to change the default value of the depth param. - // This is to allow scrolling with trackpad when hovering deep elements. - var originalFunction = ionic.DomUtil.getParentOrSelfWithClass; - ionic.DomUtil.getParentOrSelfWithClass = function(e, className, depth) { + // In desktop, re-define getParentOrSelfWithClass to allow scrolling with trackpad when hovering deep elements. + // In iOS, re-define getParentWithClass to prevent the keyboard to hide deep input elements. + var fnName = !$mmApp.isDevice() ? 'getParentOrSelfWithClass' : (ionic.Platform.isIOS() ? 'getParentWithClass' : ''); + if (fnName) { + var originalFunction = ionic.DomUtil[fnName]; + ionic.DomUtil[fnName] = function(e, className, depth) { depth = depth || 20; return originalFunction(e, className, depth); };