showModalDialog leaves gap at right hand edge

S

Steve

Hi,

I've come across what appears to be a bug in the rendering engine of internet explorer when a document is opened by
showModalDialog. Basically any elements that should render to the right hand edge of the window (i.e. Horizontal rules,
100% tables) fall short by around 15 - 20 pixels or so. I'm currently using internet explorer 6 and have created two
simple pages to demonstrate the behavior. My original pages were much more complicated but the effect remains even with
the most basic of documents.

Create a file called Dialog.html and put the following lines within it.

<HTML>
<HEAD>
</HEAD>
<BODY leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<hr>
</BODY>
</HTML>

Save it and then open it in internet explorer. The horizontal line goes from left to right perfectly to the right hand
border.

Now create a page called MainPage.html with the same folder as the previous page. Within it have this code;

<HTML>
<HEAD>
</HEAD>
<BODY>
<script language="Javascript">
window.showModalDialog('dialog.html','','dialogWidth:540px;dialogHeight:450px');
</script>
</BODY>
</HTML>


Now open MainPage.html with internet explorer and the dialog that appears will not show the HR rule to the right hand
edge, it falls short by around 20 pixels.

The same effect appears with tables that are 100%, they finish before the right hand margin and if they have a
background colour set it will look quite messy. My problem for one of our pieces of intranet software is that we have a
corporate banner that must appear at the top of every page. On dialog pages the banner falls short of the edge by a very
noticeable amount and is unacceptable.

I've coded a work around that basically checks if the current page is a dialog page and if it is it adjusts the table to
make it bigger, here's the code;

if(typeof(self.window.dialogWidth)!="undefined")
window.document.all.SmallBannerTable.width=self.window.dialogWidth;


So if it's a dialog it resizes the table to the dialog width. Actually it's sizes it a little too wide but I'll fix
that very shortly.

So my question for anyone that knows,

Is this a bug ? or am missing something that I should be doing?


Steve
Remove 'TheCompany' in email address to give correct version.
 
J

Jim Ley

So my question for anyone that knows,

Is this a bug ? or am missing something that I should be doing?

It's space reserved for the scrollbar, use CSS to ensure it's not
there.

Jim.
 
S

Steve

Ahh, well that explains it. Still seems a bit odd that the behavior isn't the same as normal windows, i.e. it should fit
to the end when no scroll bar and adjust itself when there is a scroll bar, like normal pages do. The dialogs I present
to users are generated by PHP and some may require scroll bars and some may not depending upon the amount of data to
display.

Would your CSS fix just ensure no scroll bar is present (which won't work for my pages) or are you setting some other
property ?

Thanks for your input,

Steve

It's space reserved for the scrollbar, use CSS to ensure it's not
there.

Jim.

Remove 'TheCompany' in email address to give correct version.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,218
Latest member
GracieDebo

Latest Threads

Top