Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-3902

popup.reposition put the popup in the wrong location after zk-3606

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 8.5.1
    • Fix Version/s: 8.5.1.1
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
      None

      Description

      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>
      

        Issue Links

          Activity

          Hide
          rudyhuang rudyhuang added a comment -

          Fixed since 2018/03/16

          Show
          rudyhuang rudyhuang added a comment - Fixed since 2018/03/16

            People

            • Assignee:
              rudyhuang rudyhuang
              Reporter:
              MDuchemin MDuchemin
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 5 hours
                5h
                Remaining:
                Time Spent - 1 hour Remaining Estimate - 4 hours
                4h
                Logged:
                Time Spent - 1 hour Remaining Estimate - 4 hours
                1h