Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#479 closed defect (fixed)

Bug in getScrollOffset in html.js

Reported by: henrik@… Owned by: anonymous
Priority: high Milestone:
Component: General Version: 0.2
Keywords: Cc:
Blocked By: Blocking:

Description

The first clause of getScrollOffset currently (rev 3197) reads:

	if(window.pageYOffset} {
		ret = [window.pageXOffset, window.pageYOffset];

This is not the same as checking if the window object has the pageYOffset, because it may have the value 0. Then this test will fail, even if the pageXOffset is available and greater than zero. This can be seen if you try a Menu2 popup in a window that is scrolled only to the right. The position of the popupmenu will not be next to the cursor. Then if you just scroll down the window a little bit as well, the popup will be next to the cursor. Fix is just to add an Or like below. Thanks,

Henrik Hjelte

dojo.html.getScrollOffset = function(){
	var ret = [0, 0];

	if(window.pageYOffset || window.pageXOffset){
		ret = [window.pageXOffset, window.pageYOffset];
	}else if(dojo.exists(document, "documentElement.scrollTop")){
		ret = [document.documentElement.scrollLeft, document.documentElement.scrollTop];
	} else if(document.body){
		ret = [document.body.scrollLeft, document.body.scrollTop];
	}

	ret.x = ret[0];
	ret.y = ret[1];
	return ret;
}

And here is a little extra, to small to get its own bug report: In the file templates/HtmlFloatingPane.html there is a little typo, the style for the Title Bar now reads " left; 0px; ", it should be a colon after left rather than semi-colon.

Change History (2)

comment:1 Changed 14 years ago by bill

Resolution: fixed
Status: newclosed

Fixed in #3250. FloatingPane? fixed in #3246.

comment:2 Changed 12 years ago by (none)

Milestone: 0.3release

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.