title: How can I prevent the Android keyboard from auto-scrolling to the bottom of a modal window on text input focus?
body: <p>I'm currently working on a website with member search features, and I have a modal window containing a contact form which, on specific user interaction, pops up over the rest of the content. The modal itself has a <code>position: fixed</code> property and is scrollable. However, when I select a text input and the keyboard slides up, the modal's content is scrolled to the bottom, placing the selected input outside the visible area and breaking UX flow pretty badly (since you have to scroll back up to be able to see what you're typing). Is there something I'm missing or some random property messing with scroll detection?</p>
  
  <p>Oddly, this is a problem I've only encountered on mobile and tablet Android browsers (notably Chrome and Firefox), and not on iOS (both Chrome and Safari). I've also made sure to lock multi-platform and multi-browser page scrolling with <a href="https://github.com/FL3NKEY/scroll-lock" rel="nofollow noreferrer">this JavaScript library</a>.</p>
  
  <p>Consequently, I've tried a few things already, none of which have been successful. I tried to hard-code the height of the modal to the viewport height using JavaScript (it was originally set at <code>100vh</code>), and while the scrolling stopped, I was left with an unreachable area at the bottom of the form (most likely equivalent to the height of the keyboard) containing half of a field and the submit button, which isn't really a fix in itself. I also tried to use absolute positioning with a top value forced to the current body scroll position, without success.</p>
  
  <p><strong>HTML</strong>:</p>
  
  <pre><code>&lt;section class="modal__container row row--h-center wrapper"&gt;
      &lt;div class="modal__content"&gt;
          &lt;!-- Form content (title, subtitle, fields) --&gt;
      &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>The <code>row</code> and <code>row--h-center</code> add a flexbox display to the container with centered horizontal alignment.</p>
  
  <p><strong>CSS</strong>:</p>
  
  <pre><code>.modal__container {
  
      position: fixed;
      top: 0;
      left: 0;
      width: 100vw;
      height: 100vh;
      z-index: 1000000000000;
      pointer-events: none;
      overflow-y: scroll;
  
      .modal__content {
          position: relative;
          width: 80vw;
          margin: auto 0;
      }
  }
  </code></pre>