Bug 259902

Summary: visualViewport.height returns incorrect value after closing virtual keyboard and rotating screen in web app mode
Product: WebKit Reporter: Yuwei <yuweih>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bfulgham, simon.fraser, thorton, webkit-bug-importer, wenson_hsieh, zalan, zud
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: iPhone / iPad   
OS: iOS 16   

Description Yuwei 2023-08-07 14:56:09 PDT
Repro:

1. Visit https://ywh233.github.io/ on mobile Safari
2. Add site to home screen
3. Open the added web app
4. Click `iOS rotation repro` from the link
5. Rotate to landscape mode
6. Tap the textarea
7. Tap `Done` on the virtual keyboard to close it
8. Rotate to portrait mode

Expected:

The shown visual viewport size should be 390x797, i.e. matching the size of the layout viewport

Actual:

The shown visual viewport size is 390x343, which is smaller than the layout viewport. The virtual keyboard isn't open, so this is an unexpected value.

---

This seems to be only reproducible in web app mode. I was not able to repro it on mobile Safari. Also I had to open and close the virtual keyboard to trigger the bug. Simply rotating the screen back-and-forth didn't trigger it.

Source code for repro: https://github.com/ywh233/ywh233.github.io/blob/main/ios_rotation_repro.html
Comment 1 Radar WebKit Bug Importer 2023-08-07 15:07:54 PDT
<rdar://problem/113524249>