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

Menubar ignore menuitem margin when calculating scrollable status.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 8.0.1
    • Fix Version/s: 8.0.2
    • Component/s: None
    • Security Level: Jimmy
    • Labels:
      None
    • gh.sprint.customfield.default.name:
      ZK 8.0.2 S1

      Description

      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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h