Details
-
Type: Improvement
-
Status: Closed
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 1.8
-
Fix Version/s: 1.8.1
-
Component/s: ICE-Components
-
Labels:None
-
Environment:all
Description
When a menubar is displayed at the right border of the browser window, the menu is shown outside of the window so that the user needs to scroll in order to see the menu.
This should be avoided by showing the menu on the left side of the menubar instead of the right side.
A patch to menu.js that works for us (not thoroughly tested):
show: function(supermenu,submenu,submenuDiv) {
supermenu=$(supermenu);
submenu=$(submenu);
submenuDiv=$(submenuDiv);
if (submenu) {
var menu = $(submenu);
//menu is already visible, don't do anything
if (menu && menu.style.display=='') return;
Ice.Menu.showMenuWithId(submenu);
if (submenuDiv) {
//ICE-3196
var left;
//check if menu is too far to the right
if (Ice.Menu.getPosition(supermenu,'Left')+supermenu.offsetWidth+submenu.offsetWidth>document.documentElement.scrollLeft+document.body.clientWidth){
left=-submenu.offsetWidth;
}else{
left=supermenu.offsetWidth;
}
//check if menu is too far on the botton
var top=0;
if (Ice.Menu.getPosition(supermenu,'Top')+submenu.offsetHeight>document.documentElement.scrollTop+document.body.clientHeight){
top=-submenu.offsetHeight+supermenu.offsetHeight;
}
submenu.clonePosition(supermenu, {setWidth:false, setHeight:false, offsetTop:top, offsetLeft:left});
submenu.clonePosition(submenuDiv, {setTop:false, setLeft:false, setWidth:false, setHeight:false});
} else {
//ICE-3196
submenu.clonePosition(supermenu, {setWidth:false, setHeight:false, offsetTop:supermenu.offsetHeight});
}
Ice.Menu.showIframe(submenu); //ICE-2066, ICE-2912
}
Ice.Menu.currentMenu = submenu;
},
This should be avoided by showing the menu on the left side of the menubar instead of the right side.
A patch to menu.js that works for us (not thoroughly tested):
show: function(supermenu,submenu,submenuDiv) {
supermenu=$(supermenu);
submenu=$(submenu);
submenuDiv=$(submenuDiv);
if (submenu) {
var menu = $(submenu);
//menu is already visible, don't do anything
if (menu && menu.style.display=='') return;
Ice.Menu.showMenuWithId(submenu);
if (submenuDiv) {
//
var left;
//check if menu is too far to the right
if (Ice.Menu.getPosition(supermenu,'Left')+supermenu.offsetWidth+submenu.offsetWidth>document.documentElement.scrollLeft+document.body.clientWidth){
left=-submenu.offsetWidth;
}else{
left=supermenu.offsetWidth;
}
//check if menu is too far on the botton
var top=0;
if (Ice.Menu.getPosition(supermenu,'Top')+submenu.offsetHeight>document.documentElement.scrollTop+document.body.clientHeight){
top=-submenu.offsetHeight+supermenu.offsetHeight;
}
submenu.clonePosition(supermenu, {setWidth:false, setHeight:false, offsetTop:top, offsetLeft:left});
submenu.clonePosition(submenuDiv, {setTop:false, setLeft:false, setWidth:false, setHeight:false});
} else {
//
submenu.clonePosition(supermenu, {setWidth:false, setHeight:false, offsetTop:supermenu.offsetHeight});
}
Ice.Menu.showIframe(submenu); //
}
Ice.Menu.currentMenu = submenu;
},
Issue Links
- duplicates
-
ICE-3620 Sub Menu Item should display on the left side if there is no space to display on the right
- Closed
This is fixed in 1.8.0 (see
ICE-3620).One last thing is that if the menu is displayed upwards, it is possible that the top part of it is outside the viewport.
Simply add a check if submenu.offsetTop<0 and if so, set submenu.style.top='0px';