I’ve had this exact problem for literally years. It is always Android. There was just no way i could reliably control the appearance of the virtual keyboard. It would pop up and down irritatingly, or flap about annoyingly. And it was different in different browsers!
By contrast, iOS was fine. Once i had that fettled, it remained fettled. On Android, I would think i had it fixed, then, after an update, it would start its shenanigans all over again.
Apparently, there’s a new way coming down the line. Which is basically a raw admission that it currently doesn’t work properly. But when is this? and when will it be safe to use it?
In the end, i wasted so much time, i finally gave in and wrote my own on-screen keyboard. I kept thinking to myself; this is silly, why am i doing this? Surely, i don’t really have to do this?
It took me less time that i thought, and since then, I’ve never looked back.
There are some pros and cons;
The con is that, you don’t have the system virtual keyboard and a lot of people would like that. Or they think they’d like it.
Which leads me to the main pro; size. You can comfortably have just four rows and make the keyboard around 25% of precious vertical space. By comparison, most system keyboards usually occupy as much as half the vertical space!
You can have also make it an “IF keyboard”. What’s that?
So here’s a mobile screenshot at 9:16 with my keyboard. It’s a normal layout with no silly extra keys you don’t need. Backspace and return are wider whilst “->” in place of “TAB” is for word completion/suggestions.

Suggestions are performed on the entry line so there’s no need for a wasted line of possible words.
A big win is that you don’t need both upper and lower case. So the shift key can immediately convert keys to numbers, symbols and punctuation.
Here’s a shot of the same keyboard when shift is pressed. Right now only the top row changes to numbers, but at some point, I’ll get around to changing a few other keys to useful symbols. So there’s plenty of space for future development.

Conclusion. I would totally recommend the effort to make a custom IF virtual keyboard.