made hideKeyboard more robust

Robustified hideKeyboard code.  Works with existing tests but will be adding new functional tests for swipe fallback.