This is a migrated thread and some comments may be shown as answers.

Focus and TabIndex behavior change

4 Answers 152 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 19 Nov 2008, 06:35 PM

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).

 

4 Answers, 1 is accepted

Sort by
0
Nikolay Raykov
Telerik team
answered on 24 Nov 2008, 01:13 PM
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.
0
Jeff
Top achievements
Rank 1
answered on 24 Nov 2008, 03:16 PM
I attached a project to Ticket 176059.

Unfortunately my employer still requires IE6 internally, which is frustrating.
0
Tervel
Telerik team
answered on 28 Nov 2008, 10:38 AM
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.
0
Stoick
Top achievements
Rank 2
answered on 27 Jan 2009, 05:58 PM
Thanks, I also ran into this problem recently and could not get the focus to work. The workaround did seem to resolve the issue.
Tags
FormDecorator
Asked by
Jeff
Top achievements
Rank 1
Answers by
Nikolay Raykov
Telerik team
Jeff
Top achievements
Rank 1
Tervel
Telerik team
Stoick
Top achievements
Rank 2
Share this question
or