-
Bug
-
Resolution: Fixed
-
Normal
-
None
-
None
-
Security Level: Jimmy
-
None
-
None
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>
- relates to
-
ZK-3956 popup causes spacing vlayout
- Closed