emberjs / emberjs/ember-test-helpers

When using native DOM helpers with jQuery, some events are not handled correctly

Open
#343 4 comments 8 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
188
Forks
254
PR merge metrics
No merged PRs in 30d

Description

I believe this effects 'mouseenter', 'mouseleave', 'pointerenter' , and 'pointerleave'.

The issue is that if jQuery is present, Ember's event dispatcher will use jQuery to manage events. This means if you have, for instance a `mouseEnter` handler, `on('mouseenter')` will be used. Due to historical reasons, jQuery will not actually watch for the real 'mouseenter' event but will watch for 'mouseover'.

If you are using `$(el).mouseenter()` jQuery will handle this correctly. However, if you transition to native DOM helpers and attempt to do `triggerEvent(el, 'mouseenter')` we will send only the 'mouseenter' event which the jQuery-backed event dispatcher will not recognize.

A temporary workaround in this case is `triggerEvent(el, 'mouseover')`.

Given that many people will probably be switching to native DOM helpers soon, we should consider whether anything should be done to account for this scenario.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.