Skip to content

Commit

Permalink
Add add'l code to prevent events on menu in legacy browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkfranz committed Oct 24, 2018
1 parent 2823807 commit d336a20
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/cxtmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ let cxtmenu = function(params){
position: 'absolute',
zIndex: options.zIndex,
userSelect: 'none',
pointerEvents: 'none'
pointerEvents: 'none' // prevent events on menu in modern browsers
});

// prevent events on menu in legacy browsers
['mousedown', 'mousemove', 'mouseup', 'contextmenu'].forEach(evt => {
wrapper.addEventListener(evt, e => {
e.preventDefault();

return false;
});
});

setStyles(parent, {
Expand Down

0 comments on commit d336a20

Please sign in to comment.