A chat box in an H5 game looks like a five-minute feature until you open it on a phone. The moment the on-screen keyboard slides up, the layout the game was built around stops existing: the viewport shrinks, 100vh becomes a moving target, and anything pinned to the bottom jumps by the height of the keyboard.
On Android the keyboard does not resize the layout viewport the way a desktop window resize would. It mostly moves window.visualViewport , and resize arrives late or not at all on some builds. I tested this on a handful of H5 entries that put a name field in the middle of a round. aa666 apk redraws its HUD against visualViewport and stays where it was, while csx 8888 keeps the canvas at the old height and leaves a dead strip at the bottom that swallows taps.
The fix that held up was boring: listen to visualViewport resize and scroll, keep the game canvas on a fixed pixel height, and never autofocus an input.…