This is a bug in your CSS and has nothing to do with Discourse proper; note that you will not be able to repro this here on meta.
As for the rest, sadly Apple provides no ability to query the state of the on-screen keyboard in Mobile Safari. This is further compounded by the fact that users can optionally connect a bluetooth external keyboard on any iOS device.