<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Regression (iOS 12): Keyboard dismissal leaves WKWebView viewport-fit=cover content offscreen"
   href="https://bugs.webkit.org/show_bug.cgi?id=192564">192564</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression (iOS 12): Keyboard dismissal leaves WKWebView viewport-fit=cover content offscreen
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>Safari 12
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>iPhone / iPad
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>iOS 12
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Major
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>WebKit API
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned@lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dvpdiner2@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Also filed as <a href="rdar://44655885">rdar://44655885</a>

When an input that would require webview centering is clicked, the viewport is repositioned to center that input, as iOS has traditionally done. However, when dismissing the keyboard, the viewport is not re-positioned properly back to its original position.

A test project is available on GitHub: <a href="https://github.com/dpogue/WKScrollTest/tree/ios12-keyboard">https://github.com/dpogue/WKScrollTest/tree/ios12-keyboard</a>
Run the test project on a device or simulator. Tap the text input field to open the keyboard. Tap the Done button on the keyboard to dismiss it.


Expected Results:
The keyboard overlay closes and the web view is positioned as before: filling the screen.

Actual Results:
The keyboard overlay closes, but the web view does not return to its original position, leaving a space at the bottom of the screen. If rubberband bounce scrolling is disabled, it is not possible to return the web view to its intended position.


I strongly suspect this was introduced as a side effect of <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - REGRESSION (iOS 12): Can't scroll to the bottom of the page in WKWebView while keyboard is up on pages with viewport-fit=cover"
   href="show_bug.cgi?id=187743">https://bugs.webkit.org/show_bug.cgi?id=187743</a> / <a href="https://trac.webkit.org/changeset/233905/webkit">https://trac.webkit.org/changeset/233905/webkit</a>


This is impacting several popular frameworks that embed WKWebView:

- <a href="https://github.com/apache/cordova-ios/issues/417">https://github.com/apache/cordova-ios/issues/417</a>
- <a href="https://github.com/react-native-community/react-native-webview/issues/193">https://github.com/react-native-community/react-native-webview/issues/193</a>
- <a href="https://github.com/ionic-team/capacitor/issues/814">https://github.com/ionic-team/capacitor/issues/814</a>


Some additional comments from others:

 - when the viewport is in it's "stuck" position it seems as if any web elements still respond to interaction in their proper place. They are visually off the screen, but logically in the correct spot. This is similar to <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Fixed position interaction broken with WKWebView when scrollView.bounce is false"
   href="show_bug.cgi?id=158325">https://bugs.webkit.org/show_bug.cgi?id=158325</a>

- webView.setNeedsLayout() on keyboard dismissal works as a workaround. UI is updated correctly but instantly, not smoothly like in Safari.


It sounds like the issue is essentially that the visible content area is not getting updated when the keyboard closes and the keyboard inset is removed.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>