Open Bug 362681 Opened 14 years ago Updated 2 years ago

calling focus within window.onfocus broken.


(Core :: DOM: UI Events & Focus Handling, defect)

1.8 Branch
Not set





(Reporter: tdys, Unassigned)


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0

Changing focus within a focus handler doesn't work correctly. For example if you have two iframes each with an edit control. 

the container of the iframe calls frame.contentWindow.focus() to set focus to the iframe. The Iframe detects this in its window.onfocus handler and calls the edit.focus() method. Nothing happens, focus seems to be lost. If you click on another app then back to firefox the edit then has focus.

Another work around is to use a timer to delay the edit.focus call.

This may seem obscure, but when you are trying to provide proper keyboard access it is an issue.

I don't know if it matters but the top level window is a xul chrome window.

Reproducible: Always
A minimized testcase for this would be great. (You can attach the <iframe> page first, then use its URL when making the container page.)
Assignee: nobody → events
Component: Keyboard Navigation → Event Handling
Product: Firefox → Core
QA Contact: keyboard.navigation → ian
Version: unspecified → 1.8 Branch
Assignee: events → nobody
QA Contact: ian → events
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.