WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
24129
Dropdown list doesn't open when onmousedown handler returns false
https://bugs.webkit.org/show_bug.cgi?id=24129
Summary
Dropdown list doesn't open when onmousedown handler returns false
jasneet
Reported
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
Attachments
reduced testcase
(1.01 KB, text/html)
2009-02-24 11:22 PST
,
jasneet
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
jasneet
Comment 1
2009-02-24 11:22:50 PST
Created
attachment 27923
[details]
reduced testcase
Gavin Barraclough
Comment 2
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?
Rakesh
Comment 3
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?
Alexey Proskuryakov
Comment 4
2012-03-12 13:35:36 PDT
If it still works in Firefox and IE, then it may not be expected!
Rakesh
Comment 5
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?
Alexey Proskuryakov
Comment 6
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.
Ian 'Hixie' Hickson
Comment 7
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.
Ahmad Saleem
Comment 8
2022-09-29 10:59:01 PDT
*** Safari 16 *** log: object "[object HTMLSelectElement]" (311 props: 0="[object HTMLOptionElement]", autocomplete="", disabled=false, form="null"...) log: false log: object "[object HTMLDivElement]" (288 props: align="", title="", lang="", translate=true...) log: true *** Chrome Canary 108 *** log: object "[object HTMLSelectElement]" (338 props: 0="[object HTMLOptionElement]", autocomplete="", disabled=false, form="null"...) log: false log: object "[object HTMLDivElement]" (315 props: align="", title="", lang="", translate=true...) log: true *** Firefox Nightly 107 *** log: object "[object HTMLSelectElement]" (285 props: 0="[object HTMLOptionElement]", item=function item() {\n [native code]\n}, namedItem=function namedItem() {\n [native code]\n}, add=function add() {\n [native code]\n}...) log: false log: object "[object HTMLDivElement]" (261 props: align="", click=function click() {\n [native code]\n}, attachInternals=function attachInternals() {\n [native code]\n}, focus=function focus() {\n [native code]\n}...) log: true _________ Just wanted to share updated results based on test case from
Comment 07
. It seems to me that all browsers are showing same. Can someone confirm whether something else is required? Thanks!
Alexey Proskuryakov
Comment 9
2022-09-29 12:53:54 PDT
Other browsers match Safari now, returning false from mousedown event handler prevents opening the menu.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug