How does Discourse calculate the software keyboard height on iOS?


I’m trying to make a web app that response to the changing height when I open the software keyboard on iOS. I’ve seen this feature here in this forum on iOS, but with a quick glance at the source on Github or with the Developer Tools on this site, I haven’t found anything useful.

I already tried it with window.innerHeight, but that stays constant while opening the keyboard.

Does anybody know something about this feature or point me in the right direction?


I’ve seen references to onfocus before for people dealing with the iOS soft keyboard.

Maybe this thread which mentions it will be useful for your scenario?

Thanks. These solutions only stop Safari from centering the input on focus. But I want to know the keyboard height, so I can adjust the view when the text in the textarea gets behind the keyboard while typing.