Focus and TabIndex behavior change

5 posts, 0 answers
  1. Jeff
    Jeff avatar
    2 posts
    Member since:
    Jun 2008

    Posted 19 Nov 2008 Link to this post

    I had a login form -- two rad text boxes and a button -- and was calling LoginIdRadTextBox.Focus() in the code behind (Page_PreRender).

    The TabIndex for the controls (login, password, button) was set explicitly in the markup as 10, 20 , 30 respectively.  This form was used in production for some time, but with the latest release (2008.3.1105.20) the behavior changed.  Instead of tabbing from the LoginIdRadTextBox to the PasswordRadTextBox, pressing tab would instead take you to the address bar.

    I found that the Focus() method wasn't working reliably in some browsers anyway, so I killed two birds with one stone by replacing the call to Focus() in the code-behind with this:

     

    Telerik.Web.UI.RadScriptManager.RegisterStartupScript(Page,

    GetType(Page), "Focus", String.Format("window.setTimeout(""document.getElementById('{0}_text').focus()"", 300);", LoginIdRadTextBox.ClientID), True)

    In working toward this solution, I also tried using RadAjaxManager.FocusControl() but that wouldn't work either.  I didn't want to create a case because I have the work-around above, but in future releases I'd like to see tabbing/enter key behavior in a form work exactly as it does without the decoration (I had to employ yet another work around for enter key behavior).

     

  2. Nikolay Raykov
    Admin
    Nikolay Raykov avatar
    102 posts

    Posted 24 Nov 2008 Link to this post

    Hello Jeff,

    I couldn't reproduce your problem. Could you, please, open a support ticket and send us a sample project in order to see where the problem originates? Could you also tell us if this is a specific browser issue (if it is, which browser) or this happens in all browsers?

    Best wishes,
    Nikolay Raykov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jeff
    Jeff avatar
    2 posts
    Member since:
    Jun 2008

    Posted 24 Nov 2008 Link to this post

    I attached a project to Ticket 176059.

    Unfortunately my employer still requires IE6 internally, which is frustrating.
  5. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 28 Nov 2008 Link to this post

    Hi Jeff,

    Using the sample project provided, we were able to repeat the behavior reported. We did our best to discover what could be the reason for it, but to no avail. As you mention yourself, once the user clicks with the mouse on the page, it all starts working properly. In addition to this, we also noticed that the problematic behavior is sporadic - subsequent page reloads cause it to sometimes work OK, and sometimes not.

    Concluding from our tests and debugging, we believe that it is a IE browser quirk. Unfortunately it is not possible to debug the browser behavior when tabbing from one element to another as tabIndex implementation is internal to the browser, and is not implemented through debuggable javascript.

    We were able to develop workarounds to the tune of the one developed by you, e.g. to use a slight delay when setting the focus to the initial control, e.g.:

    Telerik.Web.UI.RadScriptManager.RegisterStartupScript(Page, GetType(Page), "Focus", String.Format("window.setTimeout(""document.getElementById('{0}_text').focus()"", 300);", LoginIdRadTextBox.ClientID), True)


    Our suggestion is to use the workaround that you developed.

    Sincerely yours,
    Tervel
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. Stoick
    Stoick avatar
    11 posts
    Member since:
    Jan 2009

    Posted 27 Jan 2009 Link to this post

    Thanks, I also ran into this problem recently and could not get the focus to work. The workaround did seem to resolve the issue.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017