You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/08/22 10:24:03 UTC

[GitHub] [cordova-ios] c-emil commented on issue #417: Keyboard Dismissal Leaves Viewport Shifted in iOS 12 / XCode 10

c-emil commented on issue #417: Keyboard Dismissal Leaves Viewport Shifted in iOS 12 / XCode 10
URL: https://github.com/apache/cordova-ios/issues/417#issuecomment-523843485
 
 
   If you want a solution without jQuery that handles all inputs that are not even displayed yet, try this:
   ```js
       let isFormFieldActive = false;
   
       window.addEventListener('focusin', function focusInHack() {
         const elementName = document.activeElement.localName;
         if (['select', 'textarea', 'input'].includes(elementName)) {
           isFormFieldActive = true;
         }
       });
   
       window.addEventListener('focusout', function focusOutHack() {
         if (isFormFieldActive) {
           setTimeout(() => {
             window.scrollTo(0, document.documentElement.clientHeight);
           });
           isFormFieldActive = false;
         }
       });
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org