Skip to content

Commit 47311a6

Browse files
authored
Merge pull request #1110 from dpalou/MOBILE-2178
MOBILE-2178 ionic: Fix keyboard hiding deep input elements
2 parents 7625160 + 8222b41 commit 47311a6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

www/core/main.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,12 @@ angular.module('mm.core', ['pascalprecht.translate'])
287287
}
288288
});
289289

290-
if (!$mmApp.isDevice()) {
291-
// Re-define getParentOrSelfWithClass to change the default value of the depth param.
292-
// This is to allow scrolling with trackpad when hovering deep elements.
293-
var originalFunction = ionic.DomUtil.getParentOrSelfWithClass;
294-
ionic.DomUtil.getParentOrSelfWithClass = function(e, className, depth) {
290+
// In desktop, re-define getParentOrSelfWithClass to allow scrolling with trackpad when hovering deep elements.
291+
// In iOS, re-define getParentWithClass to prevent the keyboard to hide deep input elements.
292+
var fnName = !$mmApp.isDevice() ? 'getParentOrSelfWithClass' : (ionic.Platform.isIOS() ? 'getParentWithClass' : '');
293+
if (fnName) {
294+
var originalFunction = ionic.DomUtil[fnName];
295+
ionic.DomUtil[fnName] = function(e, className, depth) {
295296
depth = depth || 20;
296297
return originalFunction(e, className, depth);
297298
};

0 commit comments

Comments
 (0)