[DOGFOOD/BLOCK] window.focus() doesn't work

VERIFIED FIXED in M8

Status

()

Core
Event Handling
P3
critical
VERIFIED FIXED
19 years ago
19 years ago

People

(Reporter: David Hyatt, Assigned: joki (gone))

Tracking

Trunk
x86
Other
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

19 years ago
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.

Updated

19 years ago
Blocks: 7922

Updated

19 years ago
Severity: normal → critical

Comment 1

19 years ago
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!

Updated

19 years ago
Blocks: 8956

Comment 2

19 years ago
Hey TOM: This is important! Please fix ASAP! I'd like to see a target Milestone
at least.
(Assignee)

Updated

19 years ago
Status: NEW → ASSIGNED
Target Milestone: M8
(Assignee)

Comment 3

19 years ago
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.
(Reporter)

Comment 4

19 years ago
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="...">.
(Assignee)

Updated

19 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → FIXED
(Assignee)

Comment 5

19 years ago
Okay, I've checked this in.  Going to mark fixed but needs testing.

Comment 6

19 years ago
All the contentWindow.focus() calls in editor now work.

Updated

19 years ago
Status: RESOLVED → VERIFIED

Comment 7

19 years ago
Verifying fixed per cmanske's comments

Updated

19 years ago
No longer blocks: 7922
You need to log in before you can comment on or make changes to this bug.