Opened 13 years ago

Closed 13 years ago

#1978 closed defect (fixed)

Popup widget don't show at the right position.

Reported by: wara.songkran@… Owned by: bill
Priority: high Milestone: 0.9beta
Component: Widgets Version: 0.4
Keywords: Cc:
Blocked By: Blocking:

Description

I'm using Dojo 0.4 and Firefox 2.0

All widgets in my page that use dojo.widget.PopupContainerBase? internally don't show up at the right position, only at the first time (always shift 8px to the left). Maybe because all my widget tag is in td like this.

<td><div dojoType="xxx" /></td>

It didn't happen to other widget such as combobox in "test_combobox.html". After debugged, I found a line of code that cause the problem. It's line 147 of "PopupContainer?.js"

display="";

It causes the "x" value return by "document.getBoxObjectFor(node)" (which is called in "dojo.html.getAbsolutePosision") reduce by 8. I just commented that code and the problem gone. The popupwidget on the others page still work correctly but I only tested it in Firefox.

Do other browser need that line of code and what is the purpose of it in the first place. The comment say that "display temporarily, and move into position, then hide again" but I don't any position related style only zIndex one.

Regard

Wara

Attachments (1)

test_PopupContainer.html (3.9 KB) - added by wara.songkran@… 13 years ago.
PopupContainer?'s Bug testcase

Download all attachments as: .zip

Change History (7)

comment:1 Changed 13 years ago by bill

Resolution: wontfix
Status: newclosed

In order to position the popup widget, we need to know it's size. In order to know it's size, we need to make it visible. (Browser limitation)

Not sure what your issue is exactly. You haven't attached a testcase. But in any case I doubt that we will be able to support sticking popups inside a table.

comment:2 Changed 13 years ago by wara.songkran@…

Resolution: wontfix
Status: closedreopened

I've been investigating further. By using your debug method, http://dojo.jot.com/DebuggingJavascript very nice article ;-) I've found what cause this anomaly.

My widget(s) reside within DIV(container) that has "margin-left" and "margin-right" set to "auto". When set popup domNode's display-style to empty string.

with(this.domNode.style){
  display="";
  zIndex = this.beginZIndex + this.popupIndex;
}

Because the hight of the entire content is about to exceed the viewport height. When popup domNode display, the scrollbar appear and the DIV(container) is slightly shift to the left. Later the popup domNode style is set to "none" and the scrollbar is disappeared. The problem is display position is calculate when the scrollbar is shown but the popup is shown when scrollbar is hidden. That's why the popup is shift by 8px every time.

Can we solve this problem by put popup's domNode to position (0,0) before set display-style to empty string by using

this.move(0, 0, null, null)

But for me I still comment the line

display=""

Because I only use firefox and so far it don't break anything.

Regard

Wara

PS.

I don't know you guys will look at response in old-closed tickets again so I re-opened it. :)

comment:3 Changed 13 years ago by bill

OK, please attach a testcase (as simple as possible).

Changed 13 years ago by wara.songkran@…

Attachment: test_PopupContainer.html added

PopupContainer?'s Bug testcase

comment:4 Changed 13 years ago by wara.songkran@…

Thank you for your attention.

This is the testcase just put it in "dojo/tests/widget/"

Regards

Wara

comment:5 Changed 13 years ago by dylan

Milestone: 0.9

comment:6 Changed 13 years ago by bill

Milestone: 0.90.9beta
Resolution: fixed
Status: reopenedclosed

I believe this is fixed in [8741] of place.js (in the dijit tree), which sets visibility:hidden while calculating the size, thus not causing scrollbars to appear.

Note: See TracTickets for help on using tickets.