Menu - Firefox 3.6 positioning problem

Hi,
i’ve run into weird problem. My page is using context menu

function initMenu()
{
    menu = new dhtmlXMenuObject("message");
    menu.setIconsPath("js/dhtmlXMenu/imgs/");
    menu.renderAsContextMenu();
    menu.attachEvent("onClick", onButtonClick);
    menu.loadXML("_items.xml");
}

to be displayed over textarea on rightclick.

It works great “code wise” in all three major browsers for our project - IE, FF and Chrome.
But, in Firefox (3.6.) when the textarea contains a lot of text, and is scrolled down, the menu pops up way below mouse pointer.

So, when im in textarea, scrolled up, i rightclick, the menu appears where I clicked. Once i start scrolling in the textarea down, and the mouse pointer stays at the very same position on the screen, when I do rightclick, the menu appears lower on the screen than is the mouse pointer. The more i scroll, the more (as it seems, twice as much) lower I get the menu, after some time it even comes out of the screen :frowning:

I really dont understand why is this happening, and why exactly in Firefox :frowning: Anyone has experience with this, or has any idea how to solve this ?

Thank you

this is the minimal code you need to verify this in FF 3.6

[code]

[/code]

just place some big amount of text into textarea and try to see the menu on first line in textarea, then scroll down a bit, and reopen the menu again …

Hello,

we’ve managed to recreate the problem. We’ll send you the fix when it’s ready.

oh great, i thought i’m going crazy :slight_smile: glad that someone else sees this :slight_smile:

Hello,

unfortunately we didn’t manage to create a universal solution (currently it’s rather complicated to take into consideration scrolls and position of all elements). However the custom workaround is possible - please see attached demo.

In this sample the automatic menu is blocked by onBeforeContextMenu event (if event doesn’t return true, the automatic menu won’t appear). Click position is calculated manually. And showContextMenu shows menu is a certain position.
78.zip (49.3 KB)