[Webkit-unassigned] [Bug 237851] New: visualViewport.offsetTop is sometimes 0 when soft keyboard is open on web app mode

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 14 15:01:28 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=237851

            Bug ID: 237851
           Summary: visualViewport.offsetTop is sometimes 0 when soft
                    keyboard is open on web app mode
           Product: WebKit
           Version: Safari 15
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Layout and Rendering
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: yuweih at google.com
                CC: bfulgham at webkit.org, simon.fraser at apple.com,
                    zalan at apple.com

iOS version: 15.4
iPhone: iPhone 12 Pro

---

Steps:

1. Have a website that has a text input that is fixed to the bottom of the page
2. Add the website to the home screen
3. Open the web app on the home screen
4. Open JS console and run this:
   visualViewport.addEventListener('resize',  () => console.log('viewport offsetTop, height:', visualViewport.offsetTop, visualViewport.height))
5. Tap the text input, which should bring up the soft keyboard, then tap `Done` to close it, then tap the text input again. Do it a few times and observe the JS console logs

---

Expected:

Whenever the soft keyboard is open, the log should consistently look like:

  viewport offsetTop, height: 380 - 417

---

Actual:

The log is sometimes correct, but other times I will see a 0 offsetTop, like:

  viewport offsetTop, height: 0 - 417

If I add setTimeout() to the event handler and log offsetTop with a 50ms delay, then offsetTop will be 380 even when it first reports 0 inside the event handler.

Note that I have only seen it on the web app. I haven't reproed it on mobile Safari.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220314/b010c600/attachment.htm>


More information about the webkit-unassigned mailing list