Closed Bug 175501 Opened 22 years ago Closed 2 years ago

onmouseout not firing when text is being selected

Categories

(Core :: DOM: Events, defect, P4)

x86
Windows 2000
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: m.proctor, Unassigned)

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826

Mouseout does not fire correctly if the mousebutton is held while moving the
mouse. In the example below move the mouse in and out of red DIV and watch it
change color - now move over the red DIV hold the mouse button down and move out
: some of the mouseout events fire but not the all important one that goes from
DIV to BODY. The mouseevents should fire the same, regardles of whether the
button is pressed or not. I have provided a second DIV that shows the related
mouseout event information as it happens.

Is this a bug? is there a work around? I need my DIVs to turn off if the mouse
is moved outside DIV regardless of whether the button is pressed or not. In the
example below the contents is placed in a single cell table to allow both
vertical and horizontal centering.

Regards

Mark

//-----------------------------------------------
//Example
//-----------------------------------------------
<html>
<head>
<script>
Element.prototype.contains = function(a1){
  var r=document.createRange();
  r.selectNode(this);
 return r.compareNode(a1)==3;
};

 onload=function() {
   p1=document.getElementById("p1");
   p1.onmouseover = mouseOver;
   p1.onmouseout = mouseOut;
   p2=document.getElementById("p2");
 }

 function mouseOver(e) {
  e.stopPropagation();
  e.preventDefault();
   if (this.id == 'p1') this.style.backgroundColor = "blue";
 }

 function mouseOut(e) {
   e.stopPropagation();e.preventDefault();
   p2.innerHTML=this.tagName+":"+e.target.tagName+":"+e.relatedTarget.tagName;
   if (this.contains(e.relatedTarget)) return;
   this.style.backgroundColor = "red";
 }
</script>
</head>
<body>
<div id=p1 style="overflow:hidden;width:50;height:25;background-color:red;>
 <table style='width:100%;height:100%;border:1px solid
white;borderSpacing:0;margin:5px;padding:0;'>
   <tr>
     <td id='cell' unselectable='on'
style='text-align:center;vertical-align:middle'>
     Hello
     </td>
   </tr>
 </table>
</div>
<br><br>
<div id=p2>
mouse out values
</div>
</body>
</html>

Reproducible: Always

Steps to Reproduce:
1. move over the red DIV
2. hold down the mouse button 
3. move out

Actual Results:  
the DIV does not turn red

Expected Results:  
The DIV should turn red.
Attached file reporter's testcase
Confirmed on Linux 2002101701
confirmed Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2b) Gecko/20021016
does someone want to update this case so that the bug status is "new" rather
than "unconfirmed"
Confirmed based on comments.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: onmouseout not firing correctly → onmouseout not firing when text is being selected
Attached file Workaround
If you disable text selection the bug goes away, so the reason it does not
mouse out is that you are in the process of selecting some text.
Not sure what is the right behaviour...
Priority: -- → P4
Keywords: testcase
Assignee: joki → nobody
QA Contact: vladimire → events

Marking this as Resolved > Incomplete since the last activity was 19 years ago.
The issue is the same on all browsers (Chrome, Edge, Firefox) thus not making it a specific Firefox issue.
Also Comment 7 suggests the right behaviour is unknown.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: