1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    7
    Vote Rating
    0
    imcl is on a distinguished road

      0  

    Default Unanswered: Why does a textfield gain focus without tapping?

    Unanswered: Why does a textfield gain focus without tapping?


    I've noted that when I navigate to some of my form panel views, they automatically gain focus in a text field. Other form views that I navigate to don't.

    That happens despite all my views being based on almost identical code as below.

    This happens on the iOS simulator and makes the keyboard pop up although no text field was tapped.

    Any ideas how to prevent this erratic behavior?

    Code:
    Ext.define('MyApp.view.TextView', {
        extend:   'Ext.navigation.View',
        requires: ['Ext.form.Panel', 'Ext.form.FieldSet'],
        xtype:    'text',
        config: {
    
    
            navigationBar: {
                items: [
                    {
                        xtype:    'button',
                        iconMask: true,
                        text:     'Post Stuff',
                        align:    'right',
                        action:   'postStuffButton'
                    },
                    {
                        xtype:    'button',
                        iconMask: true,
                        text:     'Close',
                        align:    'left',
                        action:   'closeButton'
                    }
                ]
            },
            items: [
                {
                    title: 'MyApp',
                    xtype: 'formpanel',
                    items: [
                        {
                            styleHtmlContent: true,
                            html :            '',
                        },                
                        {
                            xtype: 'fieldset',
                            items: [{
                                xtype:       'textfield',
                                name:        'message',
                                placeHolder: 'Your text message'
                            },{
                                xtype:       'textfield',
                                name:        'tags',
                                placeHolder: 'Up to 5 tags'
                            }]
                        },
                        {
                            xtype: 'button',
                            text:  'Post',
                            ui:    'confirm'
                        }                        
                    ]
                }
            ]
        },
    });

  2. #2
    Sencha Premium Member dawesi's Avatar
    Join Date
    Mar 2007
    Location
    Melbourne, Australia (aka GMT+10)
    Posts
    1,083
    Vote Rating
    44
    Answers
    24
    dawesi has a spectacular aura about dawesi has a spectacular aura about

      0  

    Default


    does it happen on an ios device, or just in the simulator?
    Teahouse Training Company
    Official Certified Sencha Trainer

    Australia / New Zealand / Singapore / Hong Kong & APAC



    SenchaWorld.com - Sencha webinars, videos, etc
    SenchaForge.org - (coming soon)
    TeahouseHQ.com - Sencha ecosystem training portal

    Code Validation : JSLint | JSONLint | JSONPLint

  3. #3
    Sencha User
    Join Date
    Sep 2012
    Posts
    7
    Vote Rating
    0
    imcl is on a distinguished road

      0  

    Default


    just in the iOS simulator (v6) -- I haven't provisioned yet to run on a device -- have you seen this issue in your apps?

  4. #4
    Sencha User
    Join Date
    Oct 2012
    Posts
    2
    Vote Rating
    0
    SgtDick is on a distinguished road

      0  

    Default


    I have a similar problem, see http://www.sencha.com/forum/showthre...intended-focus.

    Is there an element from for example an overlapping view which is clicked first, and is located at the same position?

  5. #5
    Sencha User
    Join Date
    Sep 2012
    Posts
    7
    Vote Rating
    0
    imcl is on a distinguished road

      0  

    Default


    not really - it just focuses as soon as the view is loaded

Thread Participants: 2

Tags for this Thread