-
Bug
-
Resolution: Fixed
-
Normal
-
8.0.1
-
None
-
Security Level: Jimmy
-
None
-
ZK 8.0.2 S1
-
None
In zul.menu.Menubar._checkScrolling method.
The menubar calculate its scrollable status based on the total size of its children:
for (var i = childs.length; i-- ;) totalWidth += childs[i].offsetWidth;
However, this doesn't account for margins. Menuitems receive default margin of 4px (left+right), as the default style contains:
.z-menubar-horizontal li { margin: 0 2px;
This cause the calculated totalWidth to be nbChildren * 4px shorter that the actual displayed width. This in turn causes scroll display to not be triggered while the menu bar is smaller than the actual width but bigger that the calculated total width.
Reproduce with:
<zk> <div hflex="1"> <menubar scrollable="true" hflex="1"> <menuitem label="test long long test" /> <menuitem label="test long long test" /> <menuitem label="test long long test" /> <menuitem label="test long long test" /> <menuitem label="test long long test" /> <menuitem label="test long long test" /> <menuitem label="test long long test" /> </menubar> </div> </zk>
resize the window to trigger default / scrollable mode