Open Bug 1449527 Opened 7 years ago Updated 3 years ago

Why does Firefox fire a mouseenter event on page load?

Categories

(Core :: DOM: Events, defect, P3)

59 Branch
defect

Tracking

()

People

(Reporter: dilip16j, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.162 Safari/537.36 Steps to reproduce: When hovering over an element and then refreshing the page (without moving the mouse): Chrome does not fire the mouseenter event on page load Firefox does fire the mouseenter event on page load Actual results: Below is an example snippet. To reproduce the issue, hover over the div and then refresh the page. In Chrome, the div does not contain "mouseenter". In Firefox, it does. Note that this does not work in the Stacksnippets environment since you need to click "run snippet" first. JSFiddle: https://jsfiddle.net/9fu6cx5d/7/ let div = document.getElementById('my-div'); div.addEventListener('mouseenter', function () { div.innerHTML = 'mouseenter'; }); #my-div { width: 150px; height: 150px; background-color: #aaaaaa; } <div id="my-div"> </div> Expected results: the div should not contain mouseenter in firefox.
I can reproduce this issue on my machine Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0 In Chrome the mouse event is not fired on a reload until the mouse is moved but on Firefox it is fired once the page is loaded. Not sure if this is a DOM issue or Event Handling. Placing in Event Handling for now.
Status: UNCONFIRMED → NEW
Component: Untriaged → Event Handling
Ever confirmed: true
OS: Unspecified → All
Product: Firefox → Core
Hardware: Unspecified → All
Olli, do you know if what we're doing here is spec-compliant?
Component: Event Handling → DOM: Events
Flags: needinfo?(bugs)
Priority: -- → P3
I assume this happens because we fire the synthetic mousemove from layout. This stuff isn't spec'ed. What gecko does is quite reasonable and IIRC blink was planning to do something similar.
Flags: needinfo?(bugs)
Olli, do you think this create this issue? Or if it's an entirely different issue? https://webcompat.com/issues/14287#issuecomment-432100012
Flags: needinfo?(bugs)
Sounds like totally different issue, but then, I don't understand what https://webcompat.com/issues/14287#issuecomment-432100012 is about. The issues says menu isn't usable, but I see all the menus opening and closing just fine.
Flags: needinfo?(bugs)

Olli, any plans to resolve this issue?

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.