Bug 247410 - iPadOS window.visualViewport.height incorrect when using external keyboard
Summary: iPadOS window.visualViewport.height incorrect when using external keyboard
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: Safari 16
Hardware: iPhone / iPad iOS 16
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-11-02 23:19 PDT by Tyler Leonhardt
Modified: 2023-03-09 22:06 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tyler Leonhardt 2022-11-02 23:19:53 PDT
Steps to reproduce:

1. Have an iPad with a Magic Keyboard or other external keyboard so that the soft keyboard doesn't show up
2. Go to the repro (I stole from another issue): https://matan-hershberg-nuance.github.io/ios15-beta-visualviewport-bug/
3. tap in and out of the inputbox switching from showing the auto-complete and not
4. minimize the autocomplete too

Since the autocomplete UX is now "floating" instead of an entire bar across the screen, I expect that the visualViewport Height wouldn't change upon showing the autocomplete... but it does.

On my iPad Pro I can see the VisualViewport Height go from 727 when the input box isn't selected:
https://user-images.githubusercontent.com/2644648/199658322-ff1d64b6-09d6-497d-a7ee-abfd08980145.png

to 658 when the input box is selected:
https://user-images.githubusercontent.com/2644648/199658208-13cb1992-c5cc-4e3f-9aac-b4452e896b97.png
Comment 1 Tyler Leonhardt 2022-11-02 23:26:59 PDT
Related VS Code for the Web issue: https://github.com/microsoft/vscode/issues/149048
Comment 2 Radar WebKit Bug Importer 2022-11-03 15:20:01 PDT
<rdar://problem/101933585>
Comment 3 Tyler Leonhardt 2023-03-09 22:06:30 PST
Coming back to this as we have heard complaints from more users. We considered using `body.clientHeight` as a workaround, but unfortunately, this does not update when a user triggers the _virtual_ keyboard.

...and that, has been a 12 year problem of detecting when a user opens the virtual problem sadly:
https://stackoverflow.com/questions/2593139/ipad-web-app-detect-virtual-keyboard-using-javascript-in-safari

hoping to wave and say a fix for this is very much wanted 🙏