Open Bug 1084196 Opened 10 years ago Updated 2 years ago

mouseenter event does not fire on <button> and its descendants

Categories

(Core :: Layout, defect)

32 Branch
x86
macOS
defect

Tracking

()

UNCONFIRMED

People

(Reporter: mail, Unassigned)

References

()

Details

(Keywords: testcase)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.104 Safari/537.36

Steps to reproduce:

Added "mouseenter" event listener to a <div> element nested in a <button>

http://jsfiddle.net/ickata/u3bwqv4a/


Actual results:

The event does not fire on mouse enter.


Expected results:

The event must fire.
Keywords: testcase
It is not really expected to fire inside <button>, at least in Gecko. the contents of <button> shouldn't really be visible for the hit testing..
(But I don't recall this being defined properly anywhere. HTML4 spec used to say something about this vaguely and IIRC that is the reason for Gecko's current behavior. Blink has some different behavior.)
All other major browsers support this. Even IE 7 supports this. Firefox is the only browser which does not support it, that's why I submitted this bug.

In general I see no reason not to support mouseenter inside <button>. After all - this is idea of the <button> element - to let me have whatever I want inside it.
What is the idea of the <button>? I thought the idea is to have a button to contain random content, like images, yet behave as a button (somewhat similar to <input type="button">).
It may wrap images, divs, etc., anything which I can style and make my buttons look fancy.

We have a software that allows our users to create fancy buttons inside a WYSIWYG editor. These buttons are complex HTML structured elements (divs, spans, etc.). The user may link them to internal/external pages (the editor wraps them in <a> tag), or make them submit a form (the editor wraps them in a <button>).

As I said, these "buttons" are fancy and have nice mouse-over effects. That's why I need "mouseenter", that's why I have to attach it to the button's root <div> element (as I don't know how that button will be used).

Right now I have to apply some dirty patches for Firefox only. I don't see a reason not to fix this issue - all other browsers support it.
This is all about hit testing which is mostly about layout.
Component: DOM: Events → Layout
Bug 843003 should fix this when it lands.
Depends on: 843003
Well, if they both describe the same issue then bug 1089326 is duplicate of this one because it was added later ;)
Summary: mouseenter event does not fire on <button> and it's descendants → mouseenter event does not fire on <button> and its descendants
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.