Accessible XUL Window Sizing
Today, I ran into a problem with a window sizes, when I started trying to run SimoHealth using High Contrast Mode. Basically, what I wanted to figure out is can I initialize the window size so that it is both optimal for the normal case as well as the accessible case. My first solution was to just call window.sizeToContent on load. The problem with this is when you have a wizard with multiple pages and the first page is not the largest page then you end up with a wizard that is too small.
The solution I came up with is pretty simple, pick a default size that works for the normal case and then for other cases that the content of the page exceeds the default let the window grow. Basically, this is like setting a min size or preferred size.
// width, the preferred width,
// height, the preferred height
function setInitialDialogSize( width, height )
{
window.sizeToContent();
var nwidth = window.outerWidth;
var nheight = window.outerHeight;
dump( "nwidth: " + nwidth + ", nheight: " + nheight + "\n" );
if( nwidth < width ){
nwidth = width;
}
if( nheight < height ){
nheight = height;
}
window.resizeTo( nwidth, nheight );
}

Thanks.
It helped me a lot
It helped me a lot.
Thanks
– Kumar
It still helps even after five years later you published