mousedown/mouseup preventDefault() doesn't block click
Categories
(Core :: DOM: Events, defect, P5)
Tracking
()
People
(Reporter: ossman, Unassigned)
Details
Attachments
(1 file)
588 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0
Steps to reproduce:
- Add event listener for mouseup and mousedown
- Call preventDefault() in event handler
Actual results:
Got a click event after the mousedown and mouseup events.
Expected results:
Should only have gotten the mousedown and mouseup events.
Reporter | ||
Comment 1•5 years ago
|
||
See also bug 186356. Attached test case covers both issues.
Also buggy on Chrome:
https://bugs.chromium.org/p/chromium/issues/detail?id=1098275
Comment 2•5 years ago
|
||
Setting the component in order to involve the development team.
Comment 3•5 years ago
|
||
How is the defined in the spec?
Considering the behavior is consistent with other browsers, we shouldn't rush to do this, no matter what the spec definition is.
Comment 4•5 years ago
|
||
Dispatching click
event isn't the default action of a mousedown
event, nor mouseup
event. And spec doesn't define that we should suppress click event if preventDefault() is called in mousedown
/mouseup
event handler. This is a legacy behavior, all browser behave the same, change this would cause massive compatibility problems.
Reporter | ||
Comment 5•5 years ago
|
||
That's a shame, but understandable.
So I guess we as web page developers will have to continue adding handlers just to do preventDefault()
on click
? Or is there something else that is recommended to state that we want to handle the mouse events fully ourselves?
Description
•