The propose is to call a contextmenu made by me (myCtxMenu) "attached" to a <text>
SVG element, using Javascript (no frameworks). Something like this:
document.oncontextmenu = function() { // disable of default contextmenu
return false;
}
(...)
var groupSignal = document.createElementNS("http://www.w3.org/2000/svg", "g");
var gsignalID = "gsignal1";
groupSignal.setAttribute("id", gsignalID);
svg.appendChild(groupSignal);
var txtNameSignal = document.createElementNS("http://www.w3.org/2000/svg", "text");
(...)
txtNameSignal.setAttribute('oncontextmenu', 'return myCtxMenu(' + gsignalID + ')');
groupSignal.appendChild(txtNameSignal);
The problem is that this code runs perfectly on Chrome but not on Firefox. :(
If I change the attribute to "onclick" or "onmouseover", instead of "oncontextmenu", it works perfectly on both browsers, e.g. it calls myCtxMenu (my custom contextmenu).
Any idea to workaround this issue?
Thanks!