Open Bug 664720 Opened 13 years ago Updated 2 years ago

onmouseup event not fired when onmousedown generate a synchronous XHR

Categories

(Core :: DOM: Events, defect)

x86
Windows Vista
defect

Tracking

()

People

(Reporter: nfaugout, Assigned: smaug)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows NT 6.0) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.91 Safari/534.30
Build Identifier: 4.0.1

When an HTML element such as a DIV has onmousedown and oumouseup events each associated with a javascript function and the onmousedown code creates a synchronous ajax request, then the onmouseup function is not called if user released the mouse button before the ajax request ends.

The URL show the problem. The file that is pointed by the AJAX request waits 200ms before ending. So if you make a mouse down/up shorter than 200ms, the mouseup function is not triggered.

Reproducible: Always

Steps to Reproduce:
1. Make a mouse down/up on the blue DIV element shorter than 200ms

Actual Results:  
The mouse up function is not called

Expected Results:  
The mouse up function should be called

There is no workaround that I could find
Yeah, sync XHR messes with event handling in all the browsers.
It re-orders key events in non-gecko engines, and gecko has its own
problems like this.

Sync XHR is in general bad for UX, and I hope we could deprecate it.

But, however, this bug is perhaps something I could fix.
Status: UNCONFIRMED → NEW
Ever confirmed: true
I'll try to look at this soonish. But please remind me if I don't manage
to do anything in a week or so.
Assignee: nobody → Olli.Pettay
Hmm, this should work.
Something has regressed or something...
It works fine on IE and Chrome.

Thanks for looking at it.

(In reply to comment #1)
> Yeah, sync XHR messes with event handling in all the browsers.
> It re-orders key events in non-gecko engines, and gecko has its own
> problems like this.
> 
> Sync XHR is in general bad for UX, and I hope we could deprecate it.
> 
> But, however, this bug is perhaps something I could fix.
Hi Olli,

You told me to remind you after one week, that's what I do.

I see that Firefox has released version 5 and insist for people to upgrade from version 4 to 5.

Do I should consider that Firefox 4 will soon be deprecated ?

I will test under Firefox 5 if the BUG still exists.
(In reply to comment #5)
> You told me to remind you after one week, that's what I do.
Thanks!


> Do I should consider that Firefox 4 will soon be deprecated ?
There won't be any updates to Firefox 4. Firefox 5 is the update to
Firefox 4.
I installed Firefox 5. The BUG is still here. Do I need to file a new BUG for it ?
Blocks: 934422
Flags: needinfo?(bugs)
/me starts thinking how to remove support for sync XHR from main thread.

But I think this bug may need to be fixed before that. The problem is that all the browser
mess with the event ordering when sync XHR is involved. It just varies which events.
> Warning: Synchronous XMLHttpRequest on the main thread is deprecated because of
> its detrimental effects to the end user's experience. For more help
> http://xhr.spec.whatwg.org/

That plea regarding the main-thread sounds a bit like "Your website breaks our browser and we don't want to or can't fix it. Please stop breaking our browser."
No. It is about user experience.

Fortunately use of sync XHR is declining.

I would review a fix for this bug, but personally this isn't a high priority bug given that
sync XHR is deprecated and all the browser vendors want to get rid of it.
See for example http://blogs.msdn.com/b/wer/archive/2011/08/03/why-you-should-use-xmlhttprequest-asynchronously.aspx
Flags: needinfo?(bugs)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: