Opened 16 years ago

Closed 16 years ago

#2 closed defect (fixed)

Popup window focus problem.

Reported by: yml@… Owned by: gogo
Priority: normal Milestone: Version 1.0
Component: Xinha Core Version: 0.1
Severity: major Keywords: popup focus


Firefox 1.0 under Linux (rh9):

On the example, if you click on any popup like the table properties or the image popup, the popup window gets put behind the browser (browser regains focus instead of the popup):

Change History (9)

comment:1 Changed 16 years ago by gogo

  • Milestone set to Version 1.0
  • Status changed from new to assigned

I've seen this recently in my personal image picker popup (different to the built in one). I can't reliably reproduce the problem, and I looked at my code and I certainly focus that.

It may be a bug (or perhaps feature) in Mozilla. I'll have a look at bugzilla and see if I can find anything.

comment:2 Changed 16 years ago by gogo

  • Owner gogo deleted
  • Status changed from assigned to new

comment:3 Changed 16 years ago by gogo

  • Owner set to gogo

comment:4 Changed 16 years ago by yermol

Interestingly previous snapshots you had given me previous to the last one did not have this problem.

comment:5 Changed 16 years ago by yermol

Some more info. As soon as I click on one of the popup window buttons I get the following exception:

Error: [Exception... "'Permission denied to get property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: :: anonymous :: line 1843" data: no]
Source File:
Line: 1843

This is true of any popup.

Another datapoint that may be of relevance is if I have Xinha in a window and I open the javascript console, it gets sent to the background (implying maybe an internal bug as you suggested). Bringing it back to the foreground causes it to immediately be sent to the background ... this will happen a few times in a row until it "takes". Switching tabs to one without Xinha on it will allow me to bring up the console no problem.

comment:6 Changed 16 years ago by yermol

Just an FYI.

Commenting out line 1843 (this._iframe.contentWindow.focus();) causes both the exception and the error to cease; however the editor does not get focus when it initially loads, obviously.

comment:7 Changed 16 years ago by gogo

Ahhh. I see.

I think the problem is that when we do _createRange in Gecko (line 3765, source:trunk/htmlarea.js#10) we have to focus the editor first. I'm guessing that the popup windows at some stage call _createRange. I think maybe we only need to call activateEditor on 3765 rather than a full focus.

comment:8 Changed 16 years ago by yermol

As a test I changed the focusEditor to activateEditor on 3765 and it seems to have fixed the problem; for me at least.

comment:9 Changed 16 years ago by gogo

  • Resolution set to fixed
  • Status changed from new to closed

Committed the change.

Note: See TracTickets for help on using tickets.