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

H/Vlayout prevents submenu from opening after ZK-3956

    Details

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

      Description

      Steps to Reproduce

      Run following on ZK 8.5.2 FL

      • Click button to open 1st menu
      • move mouse to "menu 2" to open sub-menu
      <zk>
      <!-- Uncomment for workaround -->
      <!-- 	<script><![CDATA[
      	zk.afterLoad('zul.menu', function() {
      		var xMenupopup = {};
      		zk.override(zul.menu.Menupopup.prototype, xMenupopup ,{
      			afterOpenAnima_ : function() {
      				var p = this.parent;
      				while(p != null){
      					var chd = p.$n('chdex');
      					if(chd){
      						chd.style.display = "";
      					}
      					p = p.parent;
      				}
      				var result = xMenupopup.afterOpenAnima_.apply(this, arguments);
      				return result;
      			}
      		});//zk.override
      	});//zk.afterLoad
      	]]></script> -->
      
      	<hlayout>
      		<button iconSclass="z-icon-reorder" popup="mnpMenu, after_end"/>
      		<menupopup id="mnpMenu">
      			<menuitem label="Menu item 1"/>
      			<menuseparator/>
      			<menu label="Menu 2" iconSclass="z-icon-cog">
      				<menupopup>
      					<menuitem label="Load Settings" iconSclass="z-icon-upload"/>
      					<menuitem label="Save Settings" iconSclass="z-icon-download"/>
      				</menupopup>
      			</menu>
      			<menuitem label="Menu Item 3" iconSclass="z-icon-external-link"/>
      		</menupopup>
      	</hlayout>
      </zk>
      

      Current Result

      submenu triggers open(), but the "chdex" container for the submenu in the surrounding hlayout doesn't remove its "display:none" style.
      This cause the menu to not be visible

      Expected Result

      Submenu should be visible

      Debug Info

      Issue introduced by change in 3956
      https://github.com/zkoss/zk/commit/cd55fc2384daec2fb65796fe94644a1fc6fa7e09#diff-83de4d1b45ff82c8eb6e732e6e74844cR94

      menupopup.setVisible is called during afterOpenAnima and should trigger visibility.
      However, setVisible test isRealVisible which does a recursive search on parents to check for attributes such as display:none and returns false if any are found.
      > chdex doesn't become visible > menupopup thinks the parent is hidden, and doesn't complete setVisible(true)

      Root Cause

      Chdex container in the surrounding layout is display:none

      Workaround

       	<script><![CDATA[
      	zk.afterLoad('zul.menu', function() {
      		var xMenupopup = {};
      		zk.override(zul.menu.Menupopup.prototype, xMenupopup ,{
      			afterOpenAnima_ : function() {
      				var p = this.parent;
      				while(p != null){
      					var chd = p.$n('chdex');
      					if(chd){
      						chd.style.display = "";
      					}
      					p = p.parent;
      				}
      				var result = xMenupopup.afterOpenAnima_.apply(this, arguments);
      				return result;
      			}
      		});//zk.override
      	});//zk.afterLoad
      	]]></script> 
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Remaining Estimate - 4 hours
                  4h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified