Suppress ContextMenu on ADF Components

This entry is more for me to remember,as I’m sure I have read this somewhere before.
If someone has posted this before please drop a comment do that I can give credit to her/him.

Based on a question on OTN asking how to disable the normal browsers context menu, I advised to use a javascript method on the component and simply cancel the event.

As the questioner confirmed the idea works. So here is the solution:
1. Put  a af:clientListener on the component,  e. g.  an af:table, calling a javascript method nocontextmenu with activation type “contextMenu”

<af:clientListener method="nocontextmenu" type="contextMenu">

2. Implement the nocontextmenu() javascript method to cancel the browser context event as

function nocontextmenu(event) {