Closed Bug 23373 Opened 25 years ago Closed 24 years ago

document.onmousedown returns false, but default popup still appears

Categories

(Core :: DOM: UI Events & Focus Handling, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: eXv, Assigned: joki)

Details

Using the HTML/JS code below causes the two poup messages to appear, but the
default popup menu still appears even though the handler returns false. In nn4
only the js alert boxes appear as expected when the handler returns false. (That
is, if you only click on the document background as opposed to some child
element. Clicking on a child element still brings up the Left button message in
mozilla, as expected)

In the XUL code beneath the html I guess onmousedown just isn't
hooked up yet, as the alerts don't appear and the console shows:

JavaScript Error: uncaught exception: [Exception... "Method not implemented"
code: "-2147467263" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)"  location:
"chrome://navigator/content/nsContextMenu.js Line: 207"]


<html>
<head>

<script language="JavaScript">

function handleMouseClick(e) {
        if (e.which == 3) {
                alert("I don't want you to get the menu!");
                return false;
        } else if (e.which == 1) {
                alert("Left button");
                return true;
        }

}

function init() {
         document.onmousedown = handleMouseClick;
}
</script>

<body onload="init()">

<h1>Hey there!</h1> Go Ahead and Right Click anywhere.

</html>


XUL code:

<?xml version="1.0"?>

<!DOCTYPE window>
<window xmlns:html="http://www.w3.org/TR/REC-html40"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        onload="init()">

<html:script language="javascript">
<![CDATA[
function handleMouseClick(e) {
        if (e.which == 3) {
                alert("I don't want you to get the menu!");
                return false;
        } else if (e.which == 1) {
                alert("Left button");
                return true;
        }

}

function init() {
        document.onmousedown = handleMouseClick;
}

]]>
</html:script>
        <box><html:div>Hi, go click me or something</html:div></box>
</window>
To reproduce this JS error, you can also:
1) launch mozilla
2) type in a local directory, ex. file:/etc
3) right click into the window

Platform:
build 2000012909 on Linux
Looks like another dup of bug 19201. 
Putting on my list
Status: NEW → ASSIGNED
Target Milestone: M15
Mass-moving bugs out of M15 that I won't get to.  Will refit individual 
milestones after moving them.
Target Milestone: M15 → M16
Should work fine now.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Mass update:  changing qacontact to ckritzer@netscape.com
QA Contact: janc → ckritzer
Updating QA Contact.
QA Contact: ckritzer → lorca
Reassigning QA Contact for all open and unverified bugs previously under Lorca's
care to Gerardo as per phone conversation this morning.
QA Contact: lorca → gerardok
QA contact updated
QA Contact: gerardok → madhur
verified on build 2001-08-06-03-trunk
Status: RESOLVED → VERIFIED
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.