The way I know about creating a custom context menu is to prevent default browser behavior and to "design" the menu options with HTML and CSS. For example:
document.addEventListener('contextmenu', function(event){
event.preventDefault();
// Aqui você desenha e exibe seu menu feito com html/css.
}, false);
Clique com o botão esquerdo.
Then you get the position x and y from where the click event occurred and opens the menu from that point
In the specification there is a proposal that allows you to create menus for use in the whole page or in an element (div, section, etc) in specific. But currently supported only by Firefox. If you are using FF and running the snippet below, you will see that an option has been added in the context menu:
html, body { width: 100%; height: 100%; margin: 0; padding: 0 }
<body contextmenu="sopt-menu">Clique com o botão direito <b>(somente FIREFOX)</b>.</body>
<menu type="context" id="sopt-menu">
<menuitem label="Homepage" icon="http://i.stack.imgur.com/QoVP1.png"></menuitem>
<menuitem label="Acessar o Meta" icon="http://i.stack.imgur.com/QoVP1.png"></menuitem>
<menu label="Compartilhar esta pergunta">
<menuitem label="Twitter" icon="http://i.stack.imgur.com/GcF12.png"></menuitem>
<menuitem label="Facebook" icon="http://i.stack.imgur.com/crcC5.png"></menuitem>
</menu>
</menu>
For those who can not execute, the result is this: