This is a migrated thread and some comments may be shown as answers.

Hiding Keyboard when drawer opens

3 Answers 192 Views
Drawer (Mobile)
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 19 Sep 2013, 03:02 PM
Is there something I can do to force a keyboard to disappear when a drawer is opened?  I haven't tested on iOS yet, but on android with my app I have an issue if an input has focus and the keyboard is shown swiping to open the drawer will leave the keyboard open.  It was my understanding that this is a function of the input still having focus.  I  have tried a few different techniques to dismiss the keyboard, '$( document.activeElement ).blur();' didn't work and neither did '$( "input:focus" ).blur();'  I read a post on stack overflow where someone tried setting focus on a checkbox to cause the keyboard to be removed, but that didn't help either.

Anybody know of a way to handle this?
 -David

3 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 20 Sep 2013, 08:09 AM
Hello David,

this approach should work (in fact, this is the only one which I am aware of). You may check if the jQuery selector actually returns the focused element in question. 

Regards,
Petyo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David
Top achievements
Rank 1
answered on 20 Sep 2013, 09:57 PM
Well I have confirmed that this code is working properly to remove the focus off the input element, in fact it works as desired in iOS but android seems to be the problem child, it has the keyboard open still even though I can query the element and see that it no longer has focus.  I found some code for a phonegap plugin to let you dismiss the keyboard ... I would like to avoid it if possible, but perhaps this is the only way to solve this issue.

https://github.com/phonegap/phonegap-plugins/tree/master/Android/SoftKeyboard
0
Petyo
Telerik team
answered on 23 Sep 2013, 08:51 AM
Hi David,

thank you very much for sharing this. Indeed, it is not the best thing to introduce a plugin for such simple task. I think that this problem is a general one (not limited to Kendo UI), so perhaps the PhoneGap or Icenium community may be more resourceful for providing a solution to it.

Regards,
Petyo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Drawer (Mobile)
Asked by
David
Top achievements
Rank 1
Answers by
Petyo
Telerik team
David
Top achievements
Rank 1
Share this question
or