diff --git a/js/utils/keyboard.js b/js/utils/keyboard.js index d7bee46a484..9d7908c3eaf 100644 --- a/js/utils/keyboard.js +++ b/js/utils/keyboard.js @@ -95,7 +95,12 @@ function keyboardInit() { document.body.addEventListener('orientationchange', keyboardOrientationChange); - document.removeEventListener('touchstart', keyboardInit); + if (window.navigator.msPointerEnabled) { + document.removeEventListener("MSPointerDown", keyboardInit); + } + else { + document.removeEventListener('touchstart', keyboardInit); + } } function keyboardNativeShow(e) { @@ -176,7 +181,12 @@ function keyboardShow(element, elementTop, elementBottom, viewportHeight, keyboa // any showing part of the document that isn't within the scroll the user // could touchmove and cause some ugly changes to the app, so disable // any touchmove events while the keyboard is open using e.preventDefault() - document.addEventListener('touchmove', keyboardPreventDefault, false); + if (window.navigator.msPointerEnabled) { + document.addEventListener("MSPointerMove", keyboardPreventDefault, false); + } + else { + document.addEventListener('touchmove', keyboardPreventDefault, false); + } return details; } @@ -200,7 +210,12 @@ function keyboardHide() { }); // the keyboard is gone now, remove the touchmove that disables native scroll - document.removeEventListener('touchmove', keyboardPreventDefault); + if (window.navigator.msPointerEnabled) { + document.removeEventListener("MSPointerMove", keyboardPreventDefault); + } + else { + document.removeEventListener('touchmove', keyboardPreventDefault); + } document.removeEventListener('keydown', keyboardOnKeyDown); } @@ -316,6 +331,11 @@ ionic.Platform.ready(function() { // only initialize the adjustments for the virtual keyboard // if a touchstart event happens - document.addEventListener('touchstart', keyboardInit, false); + if (window.navigator.msPointerEnabled) { + document.addEventListener("MSPointerDown", keyboardInit, false); + } + else { + document.addEventListener('touchstart', keyboardInit, false); + } });