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

Modal window cause scroll position changed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 9.5.1
    • 9.0.1.1, 9.5.1
    • Components
    • Security Level: Jimmy
    • ZK 9.5.1 S1

      Steps to Reproduce

      Run fiddle:
      https://zkfiddle.org/sample/33k2i8j/1-ZK-4744

      Click button to change scroll and click button to add modal window

      Current Result

      The content scroll left change to 0

      Expected Result

      Stay the same position

      Debug Information

      caused by

      https://github.com/zkoss/zk/blob/master/zk/src/archive/web/js/zk/au.js#L1767-L1769

      introduced in ZK-4556

       

      Example fiddle is small, but on larger UI with a lot of cssFlex, this introduces rendering delays.

      It also causes components to unexpectedly reset their scroll position, etc.

      Workaround

      UPDATED WORKAROUND:

       	<script><![CDATA[
      	    zk.afterLoad("zul", function () {
      	        var _xWidget = {};
      	        zk.override(zul.Widget.prototype, _xWidget, {
      	        	resetSize_: function (orient) {
      		    		var n = this.$n();
      		    		if (n.scrollTop || n.scrollLeft) // keep the scroll status, the issue also happens (not only IE8) if trigger by resize browser window.
      		    			return;// do nothing Bug ZK-1885: scrollable div (with vflex) and tooltip
      		    		n.style[orient == 'w' ? 'width' : 'height'] = '';
      		    	}
      	        });
      	    });
      	]]></script> 
      

       

      OLD WORKAROUNDS:

       

      		<script><![CDATA[ 
      	    zk.afterLoad("zk", function () {
      	        var _xzAu = {};
      	        zk.override(zAu.cmd1, _xzAu, {
      	            addAft: function (wgt) {
      	            		var p = wgt.parent;
      	            		if(p){
      	            			prod = p ? p.z_rod : null;
      							p.z_rod = true;	            			
      	            		}
      						var result = _xzAu.addAft.apply(this, arguments);
      						if(p){
      							p.z_rod = prod;
      						}
      						return result;
      	                }
      	         });
      	    });
      	]]></script>
      

       

       

       

      			<script><![CDATA[
      	zk.afterLoad("zk", function () {
      	    var _xzAu = {};
      	    zk.override(zAu.cmd1, _xzAu, {
      			addAft: function (wgt) {
      	    				var originalAfterMount = zk.afterMount;
      	    				zk.afterMount = zk.$void;
      	    				var result = _xzAu.addAft.apply(this, arguments);
      						/* START PATCH ZK-11879*/
      						/*zk.afterMount(function () {
      							zUtl.fireSized(p);
      						});*/
      						/* END PATCH ZK-11879*/
      						zk.afterMount = originalAfterMount;
      						zUtl.fireSized(wgt.parent);
      						return result;
      				}
      	     });
      	});
      ]]></script>
      

            DevChu DevChu
            MDuchemin MDuchemin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: