`.click()` doesn't fire `mouseout` event if element is obscured
See original GitHub issueCurrent behavior:
In v3.5 a click()
action also triggers the mouseover
and mouseout
events. However, if the element becomes obscured (for example hidden behind a dialog) due to the .click()
action the mouseout
event is never fired. In some cases, this can leave the UI in a state that will cause later tests to fail.
Note: A workaround is to use .click().trigger('mouseout', { 'force': true })
.
Desired behavior:
The mouseout
event should trigger if the element becomes obscured… in other words the user can no longer hover. This is the behavior I see in the native browser.
Steps to reproduce: (app code and test code)
- A button contains a tooltip that obscures another button
- Clicking on the first button causes a dialog to be shown for 1s.
You will see that in v3.5 (but not v3.4 or native chrome) the tooltip remains even after the dialog opens and obscures the button.
Versions
v3.5
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:19 (12 by maintainers)
Top Results From Across the Web
Click event prevents mouseout from triggering - Stack Overflow
When you click on lets say the About tab and hover over and out on contact the content should be hidden. But you...
Read more >Element: mouseout event - Web APIs | MDN
The mouseout event is fired at an Element when a pointing device (usually a mouse) is used to move the cursor so that...
Read more >Moving the mouse: mouseover/out, mouseenter/leave
The mouseover event occurs when a mouse pointer comes over an element, and mouseout – when it leaves. These events are special, because...
Read more >hover - Cypress Documentation
Sometimes an element has specific logic on hover and you do need to "hover" in Cypress. Maybe the element doesn't even display to...
Read more >onmouseleave Event - W3Schools
The onmouseleave event occurs when the mouse pointer leaves an element. The onmouseleave event is often used together with the onmouseenter event, which...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m using
.trigger('mouseout', { 'force': true })
in a few places. I still think it would be useful to add an option to not send the additional mouse events.I will try this hack to avoid an error in cypress. Jquery won’t report an error if no element was found so maybe this will help us here: