Opened 8 years ago

Closed 6 years ago

#13604 closed defect (fixed)

dijit/popup::moveOffScreen() can cause horizontal scroll bar

Reported by: yuanyuan Owned by: bill
Priority: high Milestone: 1.9
Component: Dijit Version: 1.5
Keywords: popup menu, visibility, scroll bar Cc:
Blocked By: Blocking:

Description (last modified by bill)

In the file popup.js under the path dijit\_base, there are codes as below. The code section shows that the popup menu is hidden with that the top is value -9999px and the visibility is hidden.

moveOffScreen: function(/*Widget || DomNode*/ widget){
		var wrapper = widget.declaredClass ? widget._popupWrapper :(dojo.hasClass(widget.parentNode,"dijitPopup") && widget.parentNode),
		node = widget.domNode || widget;

		if(wrapper){		
			dojo.style(wrapper, {
				visibility: "hidden",
                                top: "-9999px"
			});
		}

Actually the "left" value should be assigned when the popup menu is hidden. Because the "visibility: "hidden"" shows that the popup menu occupies the space where they stay even if it is hidden. The "top" value only changes the vertical position, but the horizontal position is affected by the "left" value. Not assigning the "left" value is based on the assumption that the space is big enough to hide the popup menus and not affect other elements to display. But in the fact, the assumption is not always true, and the unneeded scroll bar always occurs because the element occupies the space even if it is hidden.

Change History (5)

comment:1 Changed 8 years ago by bill

Component: GeneralDijit
Description: modified (diff)
Milestone: tbd1.8
Owner: set to bill
Summary: issue when the pop up menu is hiddenhidden popup menu can cause scroll bar

Setting "left" is tricky because in RTL mode it can backfire. In that case you would need to set "right". Probably we used to set left, and removed it, or changed it to "50%", for that reason. Anyway, I'll take a look.

comment:2 Changed 7 years ago by bill

Milestone: 1.82.0

comment:3 Changed 6 years ago by bill

See [22394].

comment:4 Changed 6 years ago by bill

Milestone: 2.01.9
Status: newassigned
Summary: hidden popup menu can cause scroll bardijit/popup::moveOffScreen() can cause horizontal scroll bar

I doubt that hidden popups can cause a scroll bar, since we now hide popups with display:none. moveOffScreen() is just used momentarily to get the size of the popup before displaying it on the screen. But I suppose that there's an issue with moveOffScreen() where it should be setting left or right, and that could momentarily cause a horizontal scrollbar, if for some reason left or right was set on the widget's style. So I can add code to moveOffScreen() to set left or right.

comment:5 Changed 6 years ago by bill

Resolution: fixed
Status: assignedclosed

Fixed in [30742], but typed the wrong ticket number in the comment.

Note: See TracTickets for help on using tickets.