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

authentication - Mongodb revoke acccess to connect test database -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

r - Update two sets of radiobuttons reactively - shiny -