Two ways to capture the right click on a mouse.
window.oncontextmenu = () => {
console.log('right click');
return false // cancel default menu
}
//or
window.addEventListener('contextmenu', ()=>{
console.log('right click');
return false // cancel default menu
},false)
Source
https://github.com/roeib/JavaScript-snippets#capture-the-right-click-event