Results 1 to 3 of 3

Thread: Focus to Toolbar Button in IE v8 Fails

  1. #1
    Ext JS Premium Member
    Join Date
    Aug 2010
    Posts
    70

    Default Focus to Toolbar Button in IE v8 Fails

    I have a Toolbar with a ComboBox and a button. When the user selects a file from the combo, its data displays and the focus should move from the combo to the button. I do this with a call to the standard focus() function at the end of the callback function that handles the combo select. This works fine in all cases in FF and fails only in IE. In IE, the cursor clearly stays in the combo's field.

    My logging shows that the focus() function is getting called as expected and that the button reference is valid. I also tried various options on the focus() arguments, and tried setting the tabIndex on both items to make the button lower. Same results.

    I'm guessing that I'm not alone in this glitch. Any suggestions?

  2. #2
    Ext JS Premium Member
    Join Date
    Aug 2010
    Posts
    70

    Default

    The following code works fine in FF, but fails to move focus from the ComboBox to the button in IE only. In fact, the attempt to call blur() in the code below makes no difference.

    Code:
    // There are no errors in this code, the logging fn() logs the id without problem ...
    var btnRef = Ext.getCmp('myTBarButtonID');
    if (Ext.isIE){
        var elCombo = Ext.getCmp('myTBarComboBoxID').getEl();
        diaLog('To call blur() on the element id:'+elCombo.id);// any-browser logging fn().
        elCombo.blur();
    }
    btnRef.focus();
    Does this have something to do with the fact that only Internet Explorer supports focusin and focusout events?
    Please note this thread:
    http://www.sencha.com/forum/showthre...ocusout-events

    If so, it would seem that the Ext.Component.focus() function will not work in IE. Is there a common work-around? Am I missing something here?

  3. #3
    Ext JS Premium Member
    Join Date
    Aug 2010
    Posts
    70

    Default

    Here's what fixed it:
    Code:
    setTimeout(function() {
                    btnRef.focus();
                }, 20);
    As mentioned in the first post, I had fiddled with the 2nd argument to get the delay. But then I tried passing 2000 in that argument to make the delay visually obvious, and noticed that the delay on the straight "btnRef.focus(false, 2000)" call wasn't doing anything. So I tried the above. There is a timing issue as IE gets busy doing stuff. This handled it.

Similar Threads

  1. ToolBar fails to extend to the whole width of the panel
    By atchijov in forum Ext 3.x: Help & Discussion
    Replies: 17
    Last Post: 19 Jan 2011, 5:23 AM
  2. Adding button to grid toolbar fails
    By dmcclean in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 15 Dec 2010, 12:29 AM
  3. Hide dotted focus rect on toolbar button
    By grubi in forum Ext 3.x: Help & Discussion
    Replies: 10
    Last Post: 26 Nov 2009, 11:30 AM
  4. findField fails to find fields in a toolbar
    By hpet in forum Ext 2.x: Help & Discussion
    Replies: 11
    Last Post: 28 Mar 2009, 1:48 AM
  5. Toolbar items and focus ENTER 2 TAB (toolbar)
    By jamie.nicholson in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 19 Feb 2009, 5:20 PM

Posting Permissions

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