By default a ContextMenu SHOULD do what you describe - always position
itself inside the boundaries of the browser's viewport. This feature
is made possible by the "constraintoviewport" configuration property of
Menu's superclass: YAHOO.widget.Overlay. However, there was a bug in
version 2.2.2 of Menu that crippled the "constraintoviewport"
functionality. This has been fixed in 2.3.
> Is there no way to position a ContextMenu?
> I have button resting at the bottom of the viewport. If I right click,
> the context menu is cut off, you can only see the top of it.
> The ideal thing would be to calculate the size of the menu before it
> is displayed. And instead of displaying it cut-off, Do it so that the
> mouse cursor rests at the bottom left of the menu, instead of the top
> left. So the menu pops upwards, rather than downwards. Like your OS
> does it. No point in showing the menu if the user can use it.
> So i was look at 'menu.js' for a way to fix it, and it appears to be
> line 7878 (blimey) that is the problem, it just grabs the mouse X,Y
> and displays the menu there downwards.
> I have no idea how to measure the height of the menu before it shown,
> the menu doesn't actually exist in the HTML itself, it's generated by
> the JS.