It's working on older versions of ios but in the latest (11.1.1 on iPhone 8) it seems to set the window height to a very small number the first time you focus an input.
I suspect from what i have observed that it is subtracting the keyboard height twice from the webview.
If you have 2 inputs and you focus one, then focus the other the correct webview height is applied. But the first time you focus an input from an unfocussed state the window shrinks too much.