Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#621 closed defect (fixed)

Dialog.js has a bug determining the correct height of the document

Reported by: solrac@… Owned by: anonymous
Priority: high Milestone:
Component: Widgets Version: 0.2
Keywords: dialog.js Cc:
Blocked By: Blocking:

Description

Dialog.js currently finds the height of the browser window IN VIEW, but not the whole document. So if you enable a dojo dialog box on a page that scrolls a lot, you will see that the impenetrable dialog box background simply ends part way down the document and then you can click behind it.

I wrote code that fixes it, but the code can probably be improved, or written in the dojo style. Here is the fixed code:

(Lines 145 - 185)

sizeBackground: function() {
		if(this.bgOpacity > 0) {
			// var h = document.documentElement.scrollHeight || dojo.html.body().scrollHeight;
			
			//-----------------------------------------------------------------------------
			//-----------------------------------------------------------------------------
			// Code added by Carlos Saenz from http://www.quirksmode.org/viewport/compatibility.html
			// Because the original dojo code (commented out 4 lines above) was getting the
			// height of the VISIBLE window, not the entire document. This code works better
			// at getting the entire document height.
			//
			// ... added "XX" before all variable names to ensure no variable name conflicts
			//-----------------------------------------------------------------------------
			
			var XXx, XXy;
			var XXtest1 = document.body.scrollHeight;
			var XXtest2 = document.body.offsetHeight
			if (XXtest1 > XXtest2) // all but Explorer Mac
			{
				XXx = document.body.scrollWidth;
				XXy = document.body.scrollHeight;
			}
			else // Explorer Mac;
				 //would also work in Explorer 6 Strict, Mozilla and Safari
			{
				XXx = document.body.offsetWidth;
				XXy = document.body.offsetHeight;
			}
			var h = XXy;
			
			//-----------------------------------------------------------------------------
			//-----------------------------------------------------------------------------
			
			var w = dojo.html.getViewportWidth();
			this.bg.style.width = w + "px";
			this.bg.style.height = h + "px";
			this.bgIframe.size([0, 0, w, h]);
		} else {
			this.bgIframe.size(this.domNode);
		}
	},

Change History (2)

comment:1 Changed 13 years ago by bill

Milestone: 0.2.2release0.3release
Resolution: fixed
Status: newclosed

Fixed in rev 3554 if not earlier. The background size == the visible window size but as you scroll down the background is scrolled down too.

comment:2 Changed 12 years ago by (none)

Milestone: 0.3release

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.