javascript - mousemove event is triggered onscroll even when mouse was not moved on chrome -
i trying answer issue custom drop down, challenged inconsistent behavior in chrome , ff.
demo: http://jsfiddle.net/fyeht/ [added scroll event more clarity]
see below image, list items can navigated using arrow keys.
to reproduce issue:
- open console in chrome (f12)
- click on item in list (you notice events getting logged in console)
- use down arrow key navigate next item in list
- finally, issue noticed when reach last item in view , hitting down arrow scroll. check log see 'scroll', 'mouse enter' , 'mouse move' [check new demo]
the issue after reaching end of items in view, scrolls. though mouse untouched, triggers mouseenter
, mousemove
events in chrome. in ff, on scroll triggers mouseenter
make sense.
question(s):
- why
mousemove
triggered when mouse untouched? - is browser inconsistency? not find documentation on events triggered when scrolling? (never knew did)
submitted bug report: https://code.google.com/p/chromium/issues/detail?id=241476
in example, see both chrome , ff firing mouseenter dom events whenever mouse left hovering on <ul>
, pressing key down triggers browser scroll in order bring selected <li>
view.
however, chrome additionally triggering mousemove events. 1 obvious difference in mouseenter event objects 2 throw chrome, mouseevent.offsetx
, mouseevent.offsety
values included, whereas in ff these properties undefined
. so, when enter triggered chrome has decided mouse "has moved".
since mouseevent.screenx
, mouseevent.screeny
event context values not change between scroll-triggered mouseevent
instances, 1 perhaps distinguish between "artificial" mouseenter / mousemove event , "authentic" 1 storing these values prior events.
dom event specification
the dom level 2 event specification mousemove reads:
the mousemove event occurs when pointing device moved while on element.
the level 3 spec (working draft) same:
a user agent must dispatch event when pointing device moved while on element.
seems down whether 1 interprets "is moved" relatively or not.
also, in section of level 3 spec on mouse event order, states when pointer moved element, triggers mouseover, mouseenter, , mousemove, in order. every case specified there has 3 together, perhaps 1 might interpret if going trigger mouseenter event, should triggering mousemove event corresponds entering element.
Comments
Post a Comment