Titanium JIRA Archive
Appcelerator Community (AC)

[AC-1032] Alloy: Not possible to focus a TextField

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-12-31T00:07:33.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy
LabelsTCSupportTriage, focus, textfield
ReporterMatej
AssigneeMauro Parra-Miranda
Created2014-10-08T16:18:30.000+0000
Updated2016-03-08T07:37:22.000+0000

Description

It is not possible to focus a TextField in newly opened window. Works fine in Classic Ti and it worked in Alloy too... (I can't say exactly in what version ,but it worked for sure...). index.js
function openBlueWindow(e) {
    var win3 = Alloy.createController('bluewin').getView();
    $.win1.openWindow(win3);
}

$.win1.open();
index.xml
<Alloy>
    <NavigationWindow id="win1" platform="ios">
        <Window id="win2" title="Red Window" backgroundColor="red">
            <Button id="button" onClick="openBlueWindow">Open Blue Window</Button>
        </Window>
    </NavigationWindow>
</Alloy>
blueWin.js
function closeWindow(){
    $.win3.close();
}

$.textField.focus();
blueWin.xml
<Alloy>
    <Window id="win3" title="Blue Window" backgroundColor="blue">
        <Button onClick="closeWindow">Close Window</Button>
        
        <TextField id="textField" width="80%" height="35" borderWidth="1px" borderColor="gray"/>
    </Window>
</Alloy>

Attachments

FileDateSize
focusTextField.mov2014-10-14T15:10:52.000+00003279685

Comments

  1. Harish Mridha 2014-10-14

    Hi, We tried to reproduce this issue with a sample test case. It’s not a valid bug. We’ve created a workaround for this issue.

    TESTING ENVIRONMENT:

    Ti SDK 3.4.0.GA Ti CLI 3.4.0 Alloy 1.5.1 Mac OS X 10.9.5 iOS v8.0

    TEST CODE:

    index.xml
     
       <Alloy>
           <NavigationWindow id="win1" platform="ios">
               <Window id="win2" title="Red Window" backgroundColor="red">
                   <Button id="button" onClick="openBlueWindow">Open Blue Window</Button>
               </Window>
           </NavigationWindow>
       </Alloy>
       
    index.js
     
       function openBlueWindow(e) {
           var win3 = Alloy.createController('blueWin').getView();
           $.win1.openWindow(win3); 
       }
       $.win1.open();
       
    blueWin.xml
     
       <Alloy>
           <Window id="win3" title="Blue Window" backgroundColor="blue">
               <TextField id="textField" width="80%" height="35" borderWidth="1px" borderColor="gray"/>
           </Window>
       </Alloy>
       
    blueWin.js
     
       $.win3.addEventListener('open', function () {
       	$.textField.focus();
       });
       

    STEPS TO TEST:

    - Create a simple alloy project. - Update project with test code - Run on iOS device/ simulator

    EXPECTED RESULT:

    It’s working as expected. Thanks
  2. Mauro Parra-Miranda 2014-10-14

    Hello [~sko]! Can you please take a look to the posted testcase and provide your feedback? Best Regards
  3. Matej 2014-10-14

    Hi, I did try the exactly same workaround before I created this ticket. The thing is that there is some graphic issue when you try to focus a textfield on "window open" event. (See the attachment). As I mentioned in the description (I am not sure on 100%) ,but I think that focusing was working before without any problem.
  4. Matej 2014-12-31

    @Mauro Parra-Miranda, could you please tell me why did you again close an issue that wasn't resolved without any explanation? What is not possible to reproduce? I tested the issue again with Ti 3.4.1 and it still doesn't work. There is some graphic issue (blinking-flashing) when new window is opening using the workaround. I added a video to point out the problem. Focusing was working in an older SDK without any problem, so the functionality had to be broken. Why are reported issues just ignored? Thank you
  5. Matej 2014-12-31

    I can't test it now ,but I think that the issue is not working correctly only in Alloy. Classic Titanium should be alright ,so there has to be something wrong with it.
  6. Matej 2015-02-02

    C'mon guys no answer, really? If that's how it works here then it is finally clear to me why Titanium has so many bugs...

JSON Source