Hiding Keyboard when drawer opens

4 posts, 0 answers
  1. David
    David avatar
    60 posts
    Member since:
    Nov 2012

    Posted 19 Sep 2013 Link to this post

    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
  2. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 20 Sep 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. David
    David avatar
    60 posts
    Member since:
    Nov 2012

    Posted 20 Sep 2013 Link to this post

    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
  5. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 23 Sep 2013 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready