Closed Bug 327989 Opened 20 years ago Closed 20 years ago

focus() in input field during onblur or onchange not working

Categories

(Firefox :: Address Bar, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 236791

People

(Reporter: spongebob, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1 I am running in to problems where Firefox is unable to put focus back to an input field during its onfocus or onchage event. I put together a small example to demonstrate the problem: <html> <body> <input id="testField" type="text" onchange="this.focus();" onblur="this.focus();"> <input id="anotherField" type="text" onchange="setTimeout('document.getElementById(\'anotherField\').focus();',0);"> </body> </html> The second field "anotherField" works but causes additional problems. The javascript console reports the following when the setTimeout is executed: [Exception... "'Permission denied to set property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: file:///c:/dev/test.html :: <TOP_LEVEL> :: line 1" data: no] Since the field was getting focus correctly using the timeout I opted to ignore the error in console. But for some reason, after getting this error several times, the cursor disappears and I am unable to type in ANY input field. Cut and Paste appears to still work but the cursor is MIA. Redirecting the browser to a different page brings the cursor back. Reproducible: Always Steps to Reproduce: 1. Sample code 2. 3. Expected Results: Focus should have returned to input field. Cursor should not disappear.
dupe of "JavaScript focus() throws "Permission denied to get property XULElement.selectedIndex"" *** This bug has been marked as a duplicate of 236791 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
After reviewing this some more, this should probably be split into two seperate bug reports. The first problem is related to an event issue. The second is a duplicate issue with the Autocomplete. The event problem is similar to the onblur bug #53579.
You need to log in before you can comment on or make changes to this bug.