The visualViewport height in Tauri does not adjust correctly when the keyboard is shown or hidden, which affects the layout of websites. This issue is significant because many websites use visualViewport to adjust their layout dynamically, particularly to align tools and content above the on-screen keyboard.
Reproduction
Use the code snippet below to set up a listener for viewport resizing:
Open the application on an Android device or emulator with a Tauri environment.
Trigger the on-screen keyboard by focusing on an input field.
Observe that the visualViewport height does not change correctly, resulting in incorrect positioning of elements.
Expected behavior
When the on-screen keyboard is shown or hidden, window.visualViewport.height should accurately reflect the visible portion of the viewport, allowing for proper adjustment of elements positioned above the keyboard.
Observation for debugging: On Android, the issue can be resolved by navigating to the home screen without closing the app and then returning to the app. It is unclear if this workaround also applies to iOS.
Describe the bug
The
visualViewport
height in Tauri does not adjust correctly when the keyboard is shown or hidden, which affects the layout of websites. This issue is significant because many websites usevisualViewport
to adjust their layout dynamically, particularly to align tools and content above the on-screen keyboard.Reproduction
Expected behavior
When the on-screen keyboard is shown or hidden,
window.visualViewport.height
should accurately reflect the visible portion of the viewport, allowing for proper adjustment of elements positioned above the keyboard.Full
tauri info
outputStack trace
No response
Additional context
This problem is related to Tauri issue #9907.