Open Bug 1228232 Opened 5 years ago Updated 2 years ago
handled dragend event repeats indefinitely
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:42.0) Gecko/20100101 Firefox/42.0 Build ID: 20151029151421 Steps to reproduce: My code uses a handler for dragend in a div outside the expected drop area so that misplaced or canceled drops could be processed. I also wrote a handler for this function. I then attempted to drag the draggable div I created into a zone where drops were not expected (the outer div), then I "dropped" it by releasing the mouse button. NOTE: this has also been tested with programmatically added handlers and with attaching the handler to the document itself, and with various propagation issue checks; the provided file is just the simplest-to-understand version of the problem I could create. Actual results: The handler runs as expected, but then it runs over and over without end, requiring the entire tab be closed. Expected results: Once the handler function runs, the event experience should be complete and the event "over" as far as the page is concerned. This expected behavior can be seen in today-current versions of IE, Chrome and Opera.
Attachment #8692341 - Attachment mime type: application/x-httpd-php → text/html
Try to use console.log(), not alert(), since alert affects to event handling (in different browsers different ways. blink for example loses the order of key event when alert is used.) With console.log I see it being called just once.
(In reply to Olli Pettay [:smaug] from comment #1) > Try to use console.log(), not alert(), since alert affects to event handling > (in different browsers different ways. blink for example loses the order of > key event when alert is used.) > With console.log I see it being called just once. This is a situation where my writing the simplified proof-of-concept version can be misleading. The point of the handler is the alert. The user needs to be told that they cannot drop the dragged item just anywhere. The alert I gave did have this prompt replaced with something that looks like debug info, which is my fault. I imagine that this sort of alert would be one of the most common reasons for processing a dragend in a non-droppable area, so straightening out the impact of alert here might be solving a problem that would affect a lot of people. Sorry for the misleading prompt...
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.