made hideKeyboard more robust

Robustified hideKeyboard code.  Works with existing tests but will be adding new functional tests for swipe fallback.
Gotcha.  I don't know enough about this feature or its implementation to offer an opinion.  I'll go with whatever you and @jlipps decide.