Closed
Bug 102339
Opened 23 years ago
Closed 23 years ago
mouseup is fired with target being a positioned div element although mouse is outside of div
Categories
(Core :: DOM: UI Events & Focus Handling, defect)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: martin.honnen, Assigned: joki)
References
Details
Attachments
(1 file)
In the following code, if you move the mouse inside the border of the positioned div, the press the left mouse button, keep it pressed and move the mouse outside the border of the positioned div and then release the mouse button a mouseup event is fired as shown in the textarea, with the target of the mouseup being the div. I think the mouseup event should not at all be noticed by the set up event handlers as the mouseup appears on the document outside the div. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <script type="text/javascript"> function output (text) { document.getElementById('output').value = text + '\n' + document.getElementById('output').value; } function initEventHandlers () { document.getElementById('aDiv').addEventListener('mousedown', eventHandler, true); document.getElementById('aDiv').addEventListener('mouseup', eventHandler, true); } function eventHandler (evt) { output(evt.type + ': ' + evt.target.nodeName + (evt.target.id ? ' id: ' + evt.target.id : '')); } </script> </head> <body onload="initEventHandlers()"> <div id="aDiv" style="position: absolute; top: 200px; width: 200px; border: 1px solid green;" > Kibology </div> <textarea id="output" rows="5" cols="80"></textarea> </body> </html>
Reporter | ||
Comment 1•23 years ago
|
||
Assignee | ||
Comment 2•23 years ago
|
||
This is by design. We use mouse capture to allow an area which uses a mousedown to continue to get mousemoves and mouseups to allow it to implement drag-drop actions as well as window dragging. Ideally in the future we may give full control of this mouse capture via script but for now it is automatically turned on by a mousedown and turned off by a mouseup as this works in the majority of cases.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
Updated•22 years ago
|
QA Contact: madhur → rakeshmishra
Updated•22 years ago
|
QA Contact: rakeshmishra → trix
Comment 3•20 years ago
|
||
*** Bug 195339 has been marked as a duplicate of this bug. ***
Comment 4•20 years ago
|
||
Is there a workaround for this behavior to detect which element the mouseup event really occured over? Surely with drag and drop it would be handy to know where something was dragged to? This is a problem with JS menus that require click and hold to display the popup menu as the popup element doesn't recieve any events.
Updated•5 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•