javascript - Disable Right Click in React.JS -


how disable right click in canvas in reactjs. here tried still not working.

let canvas = <canvas oncontextmenu={(e)=>  {e.preventdefault(); return false;}} height={500} width={500} ref="canvas"/>; 

a warning shown in browser console.

warning: returning false event handler deprecated , ignored in future release. instead, manually call e.stoppropagation() or e.preventdefault(), appropriate.

edit: yes did stop right click functionality on canvas, problem is: drawing point on left click, , being drawn on right click, want disable that.

this js function prevent bubbling of contextmenu event, preventing context menu appearing:

canvas.oncontextmenu = function (e) {     e.preventdefault(); }; 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -