Closed Bug 120209 Opened 24 years ago Closed 23 years ago

Extra blur generated when popup windows open

Categories

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

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: bryner, Assigned: bryner)

References

Details

(Whiteboard: sun_621)

Attachments

(1 file)

When a javascript popup window opens on Linux, we do something like: focus html document focus xul document focus html document whereas on win32, the first focus of the html document doesn't exist. The net effect of this is that any popup window that has an onblur handler that closes the window (which appears to not be uncommon), will close immediately. Sites that demonstrate this bug: http://www.c2it.com (from bug 107844) http://www.panasonic.de/www/ProduktSrv/de/produkte/8431401440?InfoID=120708&RUBRIK=-1 (from bug 104297) http://www.desktop-fx.com/wallpaper/pat_texture_001.htm (from bug 109645) CC'ing people from all of these bugs, since my crash fix now exposes this problem.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.0
Ok, I believe I've tracked down what's going on here, and why this happens on Linux but not Windows. On windows, we get a synchronous focusing of the webshell window as a result of showing the widget (i.e. from window.open()). We then focus the HTML document when window.focus() happens. That's all fine. On linux, focus does not happen synchronously when a window is shown. So, we continue executing the script and focus the HTML document. Then, at some later time, we get a NS_GOTFOCUS for the webshell window, followed by NS_ACTIVATE. This causes the toplevel document (the chrome document) to take focus; at that point the onblur handler on the HTML document fires and the window is closed. Note that if no onblur handler was attached, the succeeding NS_ACTIVATE would restore focus memory and focus the HTML document. So, aside from DOM events firing that shouldn't, focus will generally end up in the correct place. saari and I talked about a possible fix which involves not firing a blur event during NS_GOTFOCUS if the focus controller is suppressed and it also has a different window as its focused window.
This is the fix saari and I discussed (I think). It seems to fix this problem nicely, but it needs the usual battery of focus regression tests run against it.
I've been running with this patch in my tree for a couple of weeks and haven't noticed any bad effects from it. saari, can you r=?
Moving Netscape owned 0.9.9 and 1.0 bugs that don't have an nsbeta1, nsbeta1+, topembed, topembed+, Mozilla0.9.9+ or Mozilla1.0+ keyword. Please send any questions or feedback about this to adt@netscape.com. You can search for "Moving bugs not scheduled for a project" to quickly delete this bugmail.
Target Milestone: mozilla1.0 → mozilla1.2
bryner, did you want to go forward with landing this patch?
Target Milestone: mozilla1.2 → ---
I'm doing a build right now on Mac, lemme run this through some quick tests and I'll r=
Comment on attachment 70193 [details] [diff] [review] preliminary patch Add some comments describing what you're doing and this bug number, and go for it. I can't break anything testing on mac. r=saari with comments
Attachment #70193 - Flags: review+
Comment on attachment 70193 [details] [diff] [review] preliminary patch sr=darin (looks good)
Attachment #70193 - Flags: superreview+
Blocks: 124285
Attachment #70193 - Flags: approval+
Comment on attachment 70193 [details] [diff] [review] preliminary patch a=asa (on behalf of drivers) for checkin to the 1.0 trunk
checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Fix has been checked into Sun's 6.2.1 branch.
Whiteboard: sun_621
*** Bug 124285 has been marked as a duplicate of this bug. ***
with a 3 hour old CVS build, Linux, all links at http://www.parker.gr/engjotter.html spawn a window that immediately closes again. Is that another bug then?
No, same bug. Damn.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Well, almost the same bug. The difference here is that the popup window is opened via a mousedown handler, so there is an odd ordering dependency because script event handlers are run first. In this case, the script event handler opens a new window and deactivates the original window, then the anchor element takes focus and deactivates the popup window, so it gets a blur. It may be that we're actually doing the right thing and this is poorly written HTML (certainly the problem could be avoided if the author opened the popup via onclick instead of onmousedown).
What is the impact of this bug on typical users? Why would it be needed for MachV?
I spun off the second issue to bug 131651. Marking this bug Fixed.
Status: REOPENED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → FIXED
QA Contact: madhur → rakeshmishra
verified on the trunk build 2002-04-25-10-trunk on Linux Red hat 7.2
Status: RESOLVED → VERIFIED
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: