Mobile virtual-keyboard pushes up content
I have an html layout / css problem in a basic chat application.
There is a page with a chat-header a chat-body and a chat-footer.
Body contains the messages, it is scrollable, the footer contains the text input.
When the user clicks on the text input, the entire content is pushed up on mobile, and i can't see my header.
Here is a snippet
2 Replies
Here is how it looks like on mobile when the virtual keyboard is visible:
https://i.stack.imgur.com/RNLmu.png
The weird thing is that i can scroll the body or at least the document, even if i specified the following css for the body:
I have tried without flex box, with different positions and different javascript alternatives.
Tried to make my header and footer fixed/absolute but it did not help either.
When my footer is fixed, it works in a way, but the header does not.
This javascript snippet is helping somewhat.
It does resize my body to the correct height when the virtual keyboard is visible but i can still scroll the entire document??
The javascript "fix" is what i want, but without the ability to scroll the document meanwhile. I want the same chat behaviour which is on discord or any other message platform.
When the virtual keyboard pops up, i want to squeeze my chat message body into the available space along with my header and footer.
Here is a gif demonstrating the javascript fix problem: