Closed Bug 169290 Opened 22 years ago Closed 22 years ago

Can not disable right click

Categories

(Core :: DOM: Events, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 72084

People

(Reporter: jkaashoek, Assigned: joki)

Details

Attachments

(1 file)

The right click of the mouse comes up with a popu menu. This behavior can not 
be stopped. Normally a return of 'false' by the mouse down handler should 
cancel the event procesing, but this is not happening. Sample mouse down 
handler:


function mouseDownHandler(e) {
	
	if (isNav)
	 {
	    if (e.which == 2 || e.which == 3)
		 {
		  // alert("Using the right button is not allowed."); 
		    return false;
		}
	} else 
	{
	    if (window.event.button==2) 
	    {
		alert("Using the right button is not allowed."); 
		window.event.cancelBubble = true; 				
		return false;
	    }
	}
	return true;
}


function init() {
	document.captureEvents(Event.FOCUS | Event.KEYDOWN | Event.MOUSEDOWN); 
	document.onFocus = focusHandler;
	document.onKeyDown = keyHandler;
        document.onMouseDown = mouseDownHandler;
}
Browser, not engine ---> DOM Level 0

Joop, could you attached reduced testcase by using the 
"Create a New Attachment" link above? 

Thanks; that will speed things along -
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Level 0
QA Contact: pschwartau → desale
This test case shows that the mouse down handler fires when a right click of
the mouse is given, but it can not stop the standard popup menu from
displaying.
Confirming report - as Joop says, the |return false;| is not 
preventing the context menu from coming up.

Reassigning to DOM Events and cc'ing Boris. I don't know too
much about this topic, but I did research these bugs:

bug 72084 
"There is no way to disable the context menu upon right-click"
	
bug 86193
"There is no way to always open the context menu upon right-click"


The second bug is still open as a "counter-bug" to the first, because
the idea of disabling the context menu turned out to be controversial.

But I think the fix in bug 72084 allows HTML authors to disable 
context menus this way:

------- Additional Comment_ #9 From Mike Pinkerton  2001-04-04 14:28 -------

There is now an oncontextmenu event. JS handlers can call event.preventDefault() 
and the context menu will never fire.



Joop, does that work? If so, we should probably mark this as
a duplicate of bug 72084 -
Assignee: jst → joki
Status: UNCONFIRMED → NEW
Component: DOM Level 0 → DOM Events
Ever confirmed: true
QA Contact: desale → vladimire
The work-around given (disabling the context menu via the 'oncontextmenu' 
event) works for us. Marking it as a duplicate of 72084

*** This bug has been marked as a duplicate of 72084 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Joop: thanks - marking Verified Duplicate 
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: