Closed Bug 810691 Opened 11 years ago Closed 3 years ago

Event propagation's target can be incorrect


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

16 Branch
Windows 7
Not set





(Reporter: drew.waddell, Unassigned)


User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0
Build ID: 20121024073032

Steps to reproduce:

The target of an event can be incorrect when a synchronous ajax request happens within the event.

 Steps to reproduce:

   - Bring up Firebug
   - Click in the first textarea, an async request is fired, no issue ever happens
   - Click in the second textarea, a sync request is fired, notice if the sync ajax request takes ~70 ms to respond the next click out of the textarea will not trigger, else there is no issue 

I have reported this to jQuery but they believe that it may just be a a Firefox bug.

jQuery Bug Report:

Actual results:

Since the steps are kind of odd I have created a video that shows what can happen.

Screen Capture video:

Expected results:

The should be correct regardless if an ajax synchrounous request happens.
Component: Untriaged → Event Handling
Product: Firefox → Core
Minimal testcase, please. Something which doesn't use jQuery, but just plain
DOM APIs, and which is *minimal*.

But yes, synchronous XHR cause event handling problems in all the browsers.
The problems are very implementation dependent. IIRC webkit based browsers may re-order key and
mouse events, Opera does something similar but the order is different and Gecko just
discards certain events which are happening during sync XHR.
Sync XHR is by all means bad for user experience and should be avoided.
No new features will be added to sync XHR running in the window context. New features will be
async only.
Is this just about mouse events being blocked while sync XHR is active?
Removed jQuery from the sync call:

The mouse event isn't really blocked it's that when it is fired it doesn't have the correct target, it has the target of the active element which makes it seem like it is blocked.  The mouse position is correct however.

Thanks for your time, effort, and consideration,
Could I still ask for a *minimal* testcase please.
Something which explains what is the result you see and what is expected result.
And contains just the necessary code. Nothing less nothing more. And hopefully attached to this bug.

But yes, something odd is happening there.
Here is a very minimal testcase.  When you click the 'test' link, you can see that the event propogation of the click event is abandoned - ie neither mouseup nor click are fired.  

It appears that the code here:

attempts to SuppressEventHandling()  - line 2887, and then later to unsuppress them:

UnsuppressEventHandlingAndFireEvents - line 2911.
Oops... reproduce steps are here:
Component: Event Handling → User events and focus handling

I cannot reproduce this. I suspect it has been fixed in the intervening years (though we still have bugs with synchronous XMLHttpRequest).

Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.