When I was initially testing without this logic the keyboard was failing, I followed the same logic as in `keyboard_helper.js` in this [code block](https://github.com/mozilla-b2g/gaia/blob/master/shared/js/keyboard_helper.js#L70-124).