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

Modal window cause scroll position changed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 9.0.1.1, 9.5.1
    • Fix Version/s: 9.5.1
    • Component/s: Components
    • Security Level: Jimmy
    • Labels:
    • gh.sprint.customfield.default.name:
      ZK 9.5.1 S1

      Description

      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>
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: