Hi Jeremy, having done some research the focus is disabled within Safari to 
stop the keyboard popping up all the time when visiting websites. This 
would be very annoying. 

I think the solution was to implement another event to grant access to the 
focus event to trigger.. Note I have not tried this as I am at home and I 
don't have access to my mobile wall of doom.

Try the following and let me know how you get on.

    $('input').on('touchstart', function () {
        $(this).focus();   // inside this function the focus works
        focused = $(this); // just for the example when I click next on fiddle
    });


Failing this then then I think the other solution is to create the input 
boxes and hide them as you have suggested.. 
PS what if I have more than 5 things I want doing?

Regards,

Garry Taylor

On Saturday, 17 May 2014 04:45:08 UTC+1, Jeremy Kallman wrote:
>
> Good idea but, unfortunately, reworking the layout is not an option.
>
> Thanks,
> Jeremy
>
> On Fri, May 16, 2014 at 4:34 AM, Garry Taylor <[email protected]<javascript:>
> > wrote:
>
>> A solution is to re-work the layout. 
>> Have only one input box with an add button (nice tick or something). When 
>> the user types their request and hits the tick it is inserted into the 
>> list. This can then keep growing and the CreateMagicList controller should 
>> remain functional. It will therefore not require a focus apart from on the 
>> initial load.
>>
>> I was thinking something like this: http://todo.breezejs.com/
>>
>> Regards,
>>
>> Garry Taylor
>>
>> On Friday, 16 May 2014 01:32:07 UTC+1, Jeremy Kallman wrote:
>>>
>>> Here is my issue:
>>>
>>> I have an array of inputs that are bound to a ng-model inside an 
>>> ng-repeat. Works really well for desktop - you can see the control at 
>>> www.pro.com.
>>>
>>> But for mobile we start with just 1 input and have a button to add 
>>> additional inputs as you go. So, in the click handler, I add one more item 
>>> to the backing array and I get a new input and then I focus that new input 
>>> in a $timeout as the input DOM element doesn't exist until the current 
>>> digest is finished. And that works fine except on mobile safari as it won't 
>>> let me focus an input unless the original click event is in the call stack (
>>> http://stackoverflow.com/questions/6287478/mobile-
>>> safari-autofocus-text-field/7332160#7332160).
>>>
>>> So I am wondering if anyone has a workaround for this? One idea I just 
>>> had was to add an additional hidden input so I can just unhide it and focus 
>>> immediately. I think that will work but that is pretty hacky so ideally 
>>> there would be some way for me to run additional code at the end of the 
>>> digest cycle after the dom has been updated inside the original call stack??
>>>
>>> Any help would be appreciated.
>>>
>>> Thanks,
>>> Jeremy
>>>
>>  -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "AngularJS" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/angular/V8Lmbng6eEE/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to