window.focus() doesn't actually work. It calls mWebShell->SetFocus(), and this doesn't work either. All this method does is set the focus to the mWindow variable of the webshell. However, this isn't really giving focus to the document inside the webshell (which is what you would expect). This is presumably because of the extra windows that are being inserted by the view system. On Windows, the window hierarchy looks like this: WebShell's mWindow |____ Some other window |______ scrollbar windows | |______ the actual window that SHOULD get the focus | |______ some mysterious 16x16 window whose origin is a mystery to me When you set the focus only to the mWindow variable, the real window that should get focused isn't getting it. Hence window.focus() isn't really working.
I boosted the severity and I'm very close to making this a "blocker". This is really making life difficult for the editor. Please fix ASAP!
Hey TOM: This is important! Please fix ASAP! I'd like to see a target Milestone at least.
Well you can have your milestone for the moment. Hopefully, if the fixes to get the content shell are in as hyatt says I can get this fix in rsn.
Yes. The code to add to make something the primary content window is <iframe type="content-primary"...> Then it will be considered the primary content shell. There is now a method in nsWebShellWindow that lets you retrieve this. GetContentWebShell is its name. You can also refer to a window's primary content area through JS by saying window.content... so you can now automatically reference your content area on your own, e.g., you can return focus to the content area by saying "window.content.focus()". Furthermore, if you need to target the primary content area, you can use the magic "_content" name in a link, for example... e.g., <a target="_content" href="...">.
Status: ASSIGNED → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → FIXED
Okay, I've checked this in. Going to mark fixed but needs testing.
All the contentWindow.focus() calls in editor now work.
Verifying fixed per cmanske's comments
You need to log in before you can comment on or make changes to this bug.