Search

ScriptManager.SetFocus script doesn't work properly in IE8 unless you choose compatibility mode. by osamashah1

Active

7
0
Sign in
to vote
Type: Bug
ID: 498707
Opened: 10/20/2009 3:42:00 AM
Access Restriction: Public
0
Workaround(s)
6
User(s) can reproduce this bug
The script manager's SetFocus script doesn't work in Internet Explorer 8 when in Internet Explorer 8 standards mode. Clicking on compatibility view seems to fix the problem.

It could have something to do with IE8 not liking the UpdatePanel's Update method (where it sets the innerHTML incorrectly). Fiddling with Multiline textboxes, and a UseSubmitBehvior=false button, and doctype fiddling doesn't seem to work.

I realise this may turn out to be an IE8 issue, but the script was rendered by Visual Studio, I'll need to cater to users of IE8, who cannot / are unwilling to patch. Since I'm writing a web control, dictating the X-UA-Compatible flag to my consumer is also not an option.
Details (expand)

Product Language

English

Version

Visual Studio 2008 SP1

Operating System

Windows XP

Operating System Language

English (UK)

Steps to Reproduce

Run the attached page in VS2008. The form default button is set to sendbutton (this is important--the textbox tb1 must not lose focus otherwise you will not reproduce the error).
Enter some text in the text box and press enter. This time, the textbox focus should return to tb1. Now enter some text again.

Actual Results

After the second or third time, Focus does not properly return to the textbox. Sometimes, the caret character pops back at the start of the textbox (but typing doesn't work). Sometimes, the caret is left in the middle of it (at the last point where you typed in the text). Other times, you lose the caret character completely. In all cases, you cannot type anything else, and you have to click on the textbox (or even somewhere else, Then the textbox) to type something in again.

Expected Results

When you press Enter, you'd expect IE8 to behave like in compatibility mode (and how Firefox / Safari / Opera / Chrome / IE7 behaves). That is, the text is submitted, focus stays with the textbox, and you can carry on typing.
      You can indicate your satisfaction with how Microsoft handled this issue by completing this quick 3 question survey.

 

File Attachments
File Name Submitted By Submitted On File Size  
TextControlBug.aspx (restricted) 10/20/2009 -
Sign in to post a comment.
Posted by AlexEC51 on 11/7/2011 at 1:51 AM
Two years ... What's up with this bug ?
Thank you for it's resolution.
Posted by JohnnyK2020 on 11/22/2010 at 11:42 AM
This occurs for me under VS2010 ASP.NET 2.0, 3.5 and 4.0 Also.

Works in latest versions of Safari, FireFox, Chrome, IE7.. Does not work in IE8. Cannot predict consistent results in IE8.

Posted by Microsoft on 10/21/2009 at 12:28 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Thank you
Sign in to post a workaround.