Closed Bug 318535 Opened 19 years ago Closed 18 years ago

window.focus() doesn't focus previously opened popup

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 351013

People

(Reporter: danswer, Unassigned)

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051024 Firefox/1.6a1 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20051024 Firefox/1.6a1 Up until about 3 weeks ago, both IE and FF behaved the same way with respect to a button which initiated: var myWin = window.open("about:blank", "_Result"); myWin.focus(); myWin would always come to the top, even when it previously existed. And this was good. This changed about 3 weeks ago (the .focus() no longer worked) upon an automatic update of Deer Park alpha 2 = FF 1.6a1. I subsequently discovered the reason lay with the Tool / Options / Content tab / Advanced dialog (Advanced button to the right of the checked Enable Javascript). It seems like the automatic update has unchecked Raise or lower windows. I have two issues with this: 1. Automatic update should NEVER change the USER SETTABLE settings to make a behaviour other than what the user already has. If it's a new option, keep it to reflect the behavioiur that the user currently experiences. At the very least make certain that the user is alerted to it. Otherwise it may take quite a long time before the user figures out where to search, especially when they are new 'features', not well documented, and possibly buggy. But the reason I've file this here is that even with that option checked the behaviour seems ill advised and can be circumvented. Use case: I've had a web app for several years now where the output of my application is directed to a second window, invoked as shown above. The main page is mostly a large text area for making editing changes while the output page is for viewing results. If the user says execute, it makes sense for the output window to show itself. If this output does not come to the top, the user will have no good reason to suspect that what they attempted to do was accomplished. They would most likely suspect something wasn't working since it's quite common (on the web in general) for buttons to not work. Furthermore, they may have to sift through many windows to find their result since typical behaviour is that if it's not in front of you, you start alt+tabbing through the list of windows. 2. window.focus(), especially on a user initiated action such as a button activation or typing should always allow the window being focused to rise to the top. Programmers may otherwise be tempted to try // picking a unique name effectively guarantees this // window, if it exists, was opened by script. And if // it didn't exist before, it does now var myWin = window.open("about:blank", "_Result"); // So we close it myWin.close(); // to ensure the following line brings it to the top myWin = window.open("about:blank", "_Result"); // even when .focus() is disabled myWin.focus(); but this is not very nice and destroys prior user positioning / sizing, not to mention might result in extra traffic / thrashing. Note that this is distinct from bug 311956 Csaba Gabor from Vienna Reproducible: Always Steps to Reproduce:
"Raise or lower windows" default setting was silently switched off after upgrade Firefox 1.5.0.4 -> 2.0 beta 1 (Win). It's an unexpected change in behavior of current web applications. If this was intended behavior (security?) please document it somewhere in release notes; otherwise web apps' authors can only guess what's happening and how to solve the problem. Example of unwanted effect: you'll miss a meeting, because reminder window in web calendaring app doesn't show up.
Attached file Testcase
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.8.1b1) Gecko/20060710 Firefox/2.0b1 Steps to reproduce: 1) Open test case (attachment #233998 [details]) 2) Click on button Expected result: Opened window will be under main window Actual result: Opened window is over main window Note: IMHO this bug name is not really correct, shouldn't contain text "Deer park"
Target custom names should never start with the underscore except for reserved names. "_Result" is not valid. See bug 351013
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9a1) Gecko/20061022 Minefield/3.0a1 I see this bug even if the "Raise or lower windows" preference is enabled.
Severity: major → normal
OS: Windows XP → All
Hardware: PC → All
Summary: Deer park window.focus() doesn't focus previously opened popup → window.focus() doesn't focus previously opened popup
Demands to change current behavior should be addressed in bug 351013. I don't see why this bug should not be resolved as a duplicate of bug 351013. There has been some discussion about this issue in bug 299424 comment #7 (and on), bug 311956 and bug 355482. > I see this bug even if the "Raise or lower windows" preference is enabled. What you may be seeing could be bug 311956 since that one looks like Linux related. *** This bug has been marked as a duplicate of 351013 ***
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: