Closed Bug 404668 Opened 17 years ago Closed 5 years ago

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

Categories

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

x86
Windows XP
defect

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: mblaine, Unassigned)

References

()

Details

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.
Um, shouldn't those be "=" instead of ":"?  I've never seen colons in any documentation for the feature string to window opening code.
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
Status: UNCONFIRMED → NEW
Ever confirmed: true
This is indeed a problem as I reported this and another problem https://bugzilla.mozilla.org/show_bug.cgi?id=442111
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?
Still bugging with FF22, isn't it ?
5 years, it's a bit long.
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: → 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

The showModalDialog API was disabled in Firefox 56 and removed later on. As a result, I believe this bug is no longer present in (more) recent versions of Firefox. Please reopen and needinfo me if you think this bug is still relevant.

Bugmail filter: showModalDialogClosure.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.