There are a handful of mouseout / mouseleave questions that don't quite fit my problem, with this being the closes I could find:
MouseOut / MouseLeave - Event Triggers on Dropdown-Menu
I still seem to experience the same behavior, so here goes. I have a page with a menu control that is shown on hover and hidden on mouseout - On this page I also have a dropdown control near the top of the page, close enough to where a couple of the menu items expose the hover menu to where it would normally cover the dropdown control. This is fine when the dropdown is closed.
If user opens the dropdown then mouses up and over one of the menu items that exposes the hover menu, the menu now appears behind the open dropdown control. This behavior is not desired, so my plan was to blur() the dropdown on mouseout to force it closed. This all works fine in chrome, but not in IE.
HTML:
<select name="child5" id="child5">
<option value="1">Item - 1</option>
<option value="2">Item - 2</option>
<option value="3">Item - 3</option>
<option value="4">Item - 4</option>
<option value="5">Item - 5</option>
</select>
<br/>
<div id="sometext"></div>
jQuery (attempt 1, also previously tried these with mouseout) Fiddle: https://jsfiddle.net/9wb77r6z/6/
$(document).ready(function () {
$("#child5").mouseleave(function () {
$(this).blur();
});
});
jQuery (attempt 2) Fiddle: https://jsfiddle.net/9wb77r6z/9/
$(document).ready(function () {
$("#child5").mouseleave(function (e) {
if (e.target.id == $(this).attr("id")) {
$(this).blur();
} else {
alert("nope!");
}
});
});
Expected behavior can be witnessed in Chrome. When the dropdown is clicked and open, it remains open until an item is selected (click) or the user triggers mouseout / mouseleave (i've tried both, both work in Chrome but not IE11).
When the user clicks the dropdown in IE11, it almost immediately triggers the mouseleave event, triggering my $("#child5").blur(); which essentially makes the dropdown useless with the mouse.
Anyone have ideas? Thanks