Bug 24129 - Dropdown list doesn't open when onmousedown handler returns false
Summary: Dropdown list doesn't open when onmousedown handler returns false
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://www.emule-island.com/
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2009-02-24 11:22 PST by jasneet
Modified: 2012-03-19 11:14 PDT (History)
5 users (show)

See Also:


Attachments
reduced testcase (1.01 KB, text/html)
2009-02-24 11:22 PST, jasneet
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description jasneet 2009-02-24 11:22:31 PST
I Steps:
Go to http://www.emule-island.com/

II Issue : 
In right column, Dropdown for Films is not working. On clicking dropdown arrow, doesn't show dropdown list

III Conclusion:
In the javascript, they are setting the <div>s with className "menuItem" with the following: 
     alldiv[i].onmousedown = selectMenuItem;

in which selectMenuItem  is a function defined as: 
function selectMenuItem(e) {
	if(document.all)e = event;
	if (e.target) source = e.target; 
				else if (e.srcElement) source = e.srcElement;
			if (source.nodeType == 3) // defeat Safari bug
				source = source.parentNode;
				
	return false;
}

This is causing the issue in webkit. 

IV Other Browsers:
FF3: OK
IE7: OK 

V Nightly tested: 41018

Bug in Chromium : http://code.google.com/p/chromium/issues/detail?id=6932
Comment 1 jasneet 2009-02-24 11:22:50 PST
Created attachment 27923 [details]
reduced testcase
Comment 2 Gavin Barraclough 2012-03-08 18:57:36 PST
This doesn't look like an issue in the JSC part of the code, like bindings or events?
Comment 3 Rakesh 2012-03-12 13:24:44 PDT
(In reply to comment #2)
> This doesn't look like an issue in the JSC part of the code, like bindings or events?
The event handler "selectMenuItem" in the script mentioned above returns false.
Hence the default action is prevented from JSEventListener::handleEvent() (http://trac.webkit.org/browser/trunk/Source/WebCore/bindings/js/JSEventListener.cpp#L156).

If returning false from event handler is for preventing default action then this is an expected behavior?
Comment 4 Alexey Proskuryakov 2012-03-12 13:35:36 PDT
If it still works in Firefox and IE, then it may not be expected!
Comment 5 Rakesh 2012-03-13 10:54:59 PDT
(In reply to comment #4)
> If it still works in Firefox and IE, then it may not be expected!

The specs http://dev.w3.org/html5/spec/Overview.html#event-handler-attributes says "If return value is a boolean with the value false, then cancel the event." and I think our implementation is as per specs.

Shall we keep it as it is or make it similar to Firefox/IE?
Comment 6 Alexey Proskuryakov 2012-03-13 11:28:22 PDT
I don't have a complete answer. If HTML5 is blatantly incompatible with both IE and Firefox, then the spec and WebKit should likely change. But there may be something more subtle in this particular case.
Comment 7 Ian 'Hixie' Hickson 2012-03-19 11:14:52 PDT
The event should be canceled, that's not the problem here.

The difference is that in Firefox, the dropdown drops before the event is fired.

Compare the behaviours on this test:
   http://software.hixie.ch/utilities/js/live-dom-viewer/saved/1412

The HTML spec doesn't say anything about how the widgets are implemented at that level. It differs from platform to platform, so there's not much the spec _can_ say. For compatibility, though, it seems that select widgets implemented using dropdowns should drop down before the mousedown event is fired at the DOM.