Search code examples
javajsfprimefacesmenubar

JSF PrimeFaces MenuBar dropdown submenu disapearing after hover in p:layout


Doing some application in JSF PrimeFaces 3.1.1 (still learning) and I implemented full page layout - Sunny (the <p:layout /> tag). Everytihng is fine, except my menu bar.

On hover on the submenu button in the menu, the dropdown submenu shows, but when I want to go by mouse to the submenu, it disappears. The only option is to change the mouse position to the submenu very fast - than it stays. And thats the problem, need it to work normally, not dissappearing.

If I put the layouts out, the menubar works well again. Also tried to copy & paste code from PF showcase, issue was the same.

Using JSF 2 on Tomcat 7.0.22.0. Here is something of my code...

The menubar in a template:

<p:layoutUnit position="north" size="130">
    <ui:insert name="top">
        <p:menubar id="mainMenu" model="#{menu.mainMenu}" />
    </ui:insert>
</p:layoutUnit>

The CSS solving overflow problems:

.ui-layout-north .ui-layout-unit-content {
    overflow: visible !important;
}

.ui-layout-north {
    z-index: 30 !important;
    overflow: visible !important;
}

Thanks for help!


Solution

  • Did you happen to set a custom font size for your ui-widget? Personally, I had the following CSS setting:

    .ui-widget {
        font-size: 12px !important;
    }
    

    and I experienced similar issue like yours in Firefox (but not in Chrome). Oddly enough, after increasing font-size to 13px the problem was fixed.