Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a way of detecting whether a window resize event was caused by Android's popup keyboard?

I'm writing a webpage, which will fully support mobile browsers.

The page currently uses KnockoutJS to dynamically recalculate component sizes (and hide some components) based on the screen (or container) size.

I have a problem with the android browser:

When you click on a text field, the pop up keyboard causes a screen resize, which causes KnockoutJS to (correctly) re-render the display. This momentarily causes the text field to lose focus, which pop-up keyboard to disappear.

If only I could know whether a resize was caused by the pop-up keyboard...

Thanks,

Chris.

like image 870
fadedbee Avatar asked Feb 05 '12 12:02

fadedbee


1 Answers

Solved this by adding a listener to the input's focus event which disables reacting to resize events for 0.5s.

like image 146
fadedbee Avatar answered Oct 11 '22 10:10

fadedbee