window.showModalDialog(...) ignores "center:yes" passed in option string

NEW
Unassigned

Status

()

P5
normal
11 years ago
2 months ago

People

(Reporter: mblaine, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b1) Gecko/2007110904 Firefox/3.0b1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b1) Gecko/2007110904 Firefox/3.0b1

If I call showModalDialog like this:
window.showModalDialog("Popup.html",null,"dialogHeight:300px;dialogWidth:600px;resizable:no;center:yes");

Where Popup.html contains this:
<html><head><title>Popup</title></head>
<body style="font-family:Arial"><h3>Hello!</h3><form>
<input type="button" value="Close" OnClick="window.close();"/>
</body></html>

The resulting popup has the specified dimensions and is not resizable, but is not centered over the main browser window it spawned from.

When Firefox is not maximized, the popup positions itself over the top-left corner of the main browser window. When Firefox is maximized, it positions itself over the top-left corner of where Firefox would be if you "un-maximized" it.

No matter whether I use "center:on", "center:yes", "center:1", or don't specify "center" at all (according to the documentation, centered:yes is the default: http://developer.mozilla.org/en/docs/DOM:window.showModalDialog) the popup isn't centered.

Reproducible: Always

Steps to Reproduce:
Try the example, which doesn't specify "center" at all, but should be centered because "yes" is the default according to the documentation (http://developer.mozilla.org/en/docs/DOM:window.showModalDialog), here: http://developer.mozilla.org/samples/domref/showModalDialog.html

Or, take the example and try to include "center:on", "center:1", or "center:yes" in window.showModalDialog's 3rd parameter.


Actual Results:  
The modal popup window isn't centered.

Expected Results:  
The modal popup window should be centered over the main Firefox window behind it.

Using Firefox 3 Beta 1. I have always used portable Firefox on a flash drive, so this is the first time I installed Firefox on my machine itself. So, just a clean install. OS: Windows XP SP2.

Comment 1

11 years ago
Um, shouldn't those be "=" instead of ":"?  I've never seen colons in any documentation for the feature string to window opening code.
(Reporter)

Comment 2

11 years ago
I just tested it now, and whether I use colons or equals in the options string to showModalDialog() it doesn't make any difference. "dialogHeight", "dialogWidth", and "resize" work either way, and "center" doesn't.

The example tied to the documentation for this does use colons.

Side note: showModalDialog() was just implemented relatively recently:
https://bugzilla.mozilla.org/show_bug.cgi?id=194404

Updated

11 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true

Comment 3

10 years ago
This is indeed a problem as I reported this and another problem https://bugzilla.mozilla.org/show_bug.cgi?id=442111

Updated

9 years ago
Duplicate of this bug: 442111

Updated

9 years ago
Duplicate of this bug: 469953

Comment 6

6 years ago
This bug looks pretty old.  I'm seeing this behavior in Firefox 11.  Is anyone working to get this fixed?  Is there a workaround for this issue?

Comment 7

5 years ago
Still bugging with FF22, isn't it ?
5 years, it's a bit long.

Comment 8

5 years ago
And it's terribly broken if you don't give the center option anyway, for instance it appears in the top middle of my left hand monitor, even though the browser is in the top right of the right hand one !
See Also: → bug 554811
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046

Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5.

If you have questions, please contact :mdaly.
Priority: -- → P5
You need to log in before you can comment on or make changes to this bug.