Now this issue has made it on here before (What is the height of iPad's onscreen keyboard?), but I think it needs a refresher due to iOS7 recently being released.
The issue: I have a fixed position modal that appears in the bottom right corner of the page. It has a single form field that gains focus when the modal opens. The focus triggers the softkeyboard to open. The problem is that I want to programatically detect the keyboard height to position the modal at the top of the keyboard, otherwise part of the modal gets cutoff from view.
What I've tried:
var scrollHere = currentWidget.offset().top;
//this scrolls the page to the top of the widget, but the keyboard is below.
setTimeout(function() {
$('html, body').scrollTop(scrollHere);
}, 0);
The page scrolls to the top of the modal. Not ideal because sometimes the form field is hidden below the keyboard.
I have also tried alerting the window.innerHeight
alert(window.innerHeight);
But that shows up to be the same whether or not the keyboard is visible.
So my question is, has anyone found a way to detect the iOS7 keyboard height in JavaScript? Might there be a workaround? Unlikely, but could this be a bug in iOS7 safari?
Any help would be appreciated. Thank you.