-
Bug
-
Resolution: Fixed
-
Major
-
8.5.1
-
None
-
Security Level: Jimmy
-
None
Steps to Reproduce
fiddle:
http://zkfiddle.org/sample/6qdvuv/2-zk-popup-position
Click on the button to open a popup on the target
This also cause the window to fire resize.
When window resize, the location of the popup is calculated by zul.wgt.Popup.prototype.reposition()
Current Result
Popup position is calculated based on it's parent, not based on it's target.
Expected Result
Popup position should be calculated based on target.
Debug Info
https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/wgt/Popup.js#L408
Root Cause
Following ZK-3606, page-level popup received their target as fake parent (which works under this scenario), however popups with an already existing parent would be positioned incorectly.
Workaround
<script><![CDATA[ zk.afterLoad('zul.wgt', function() { var xPopup = {}; zk.override(zul.wgt.Popup.prototype, xPopup ,{ reposition: function () { var openInfo = this._openInfo; //once opened if (openInfo) { //openInfo: ref, offset, position, opts var posInfo = this._posInfo(openInfo[0], openInfo[1], openInfo[2]); if (posInfo) jq(this.$n()).zk.position(posInfo.dim, posInfo.pos, openInfo[3]); } } });//zk.override });//zk.afterLoad ]]></script>