Open Bug 573338 Opened 14 years ago Updated 2 years ago

context menu handler run after alert from blur handler

Categories

(Firefox :: General, defect)

3.6 Branch
x86
Windows 7
defect

Tracking

()

UNCONFIRMED

People

(Reporter: angelo.borsotti, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.4) Gecko/20100527 Firefox/3.6.4
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.4) Gecko/20100527 Firefox/3.6.4

The example page contains an input text field and a button.
The input element has a blur event handler that executes an alert().
The button has a mouse click and a context menu (mouse right click) handlers.
When the user has introduced some text in the input element, and then clicks
on the button, the alert is shown, and the mouse click handler is NOT executed.
If, instead of clicking the button with the (left) mouse button, the user
clicks with the right one, the button handler IS executed.
This happens immediately after the display of the alert dialogue.


Reproducible: Always

Steps to Reproduce:
1. load the following page, and open the firebug console:
<html>
<head>
<script type="text/javascript">
function blu(){
    console.log("before alert");
    alert("blur");
    console.log("after alert");
    return false;
}
function clic(){
    console.log("click");
    return false;
}
</script>
</head>
<body>
<input type=text onblur=blu()>
<button id=button onclick=clic()>hit me</button>
<script>
document.getElementById("button").oncontextmenu = clic;
</script>

</body>
</html>

2. introduce some text in the input element
3. click with the right mouse button on the button
Actual Results:  
before alert
click
after alert

Expected Results:  
before alert
after alert

The behavior of the context menu handler, besides being different
from that of the onclick handler, impairs the implementation of
input validation: the blur event allows to run a handler that
checks the user input, and when the check fails, to tell the
user to change it. Any action that caused the input element to
loose focus must become void: nothing should be done until the
user provided proper input (this is the meaning of a modal dialogue
as an alert).
Version: unspecified → 3.6 Branch
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.