Results 1 to 4 of 4

Thread: focus issue on iPad with text field

  1. #1

    Default focus issue on iPad with text field

    Hi,
    I'm developing an app designed to allow the user scanning multiple barcodes where a text field reads a value to fill a list. In the action event of that text field there is some data processing and at then end the value is cleared and the focus is set to that control again so the user can continue entering values without having to select the control each time. That works fine with Chrome when I enter a value and press Enter, the control keeps the focus. But the issue is with the iPad either when typing the values from the virtual keyboard or scanning a value with a barcode reader. After hitting the Go key on the virtual keyboard the code is executed correctly in the action event but the focus is not set to the control so I need to tap the text field after each read which is really annoying. When using the barcode scanner there is no virtual keyboard but the value is processed like if it was typed on the keyboard and the focus can't be set to the text field.
    Is there something more than "mytextfield.focus()" I need to do to set the focus correctly on a text field? Is there a solution to have this working?

    Thank you

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    Mobile devices have always been a little iffy about programmatically focusing on a field.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User
    Join Date
    Apr 2012
    Location
    New Jersey
    Posts
    1,149
    Answers
    132

    Default

    That is very strange... Everywhere I use (field).focus() after using (field).element.dom.blur() [hides the keyboard and loses focus] it always works on the iPad and Chrome for me..

  4. #4

    Default

    Hi jerome76,
    Thank you for responding. I tried adding your line with the blur method but it still doesn't work on the iPad.

    This is the end of my code in the action event of my text field:
    textfield.setValue("");
    textfield.element.dom.blur();
    textfield.focus();

    When using the virtual keyboard to enter the values the keyboard should always be visible since the text field should always have the focus. In my code I set the focus to the text field when its container is shown on the screen and that works fine, I can immediately enter a value. But after I hit the Go key or scan a value the text field doesn't get the focus. Maybe I'm still missing something.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •