Skip to content

Commit

Permalink
Merge pull request foundation#11411 from arloduff/fix/check-for-null-…
Browse files Browse the repository at this point in the history
…related-target

fix: resolve dropdown menu disappearing for foundation#11410
  • Loading branch information
ncoden authored Jul 20, 2018
2 parents ae3c7f5 + ebc4be7 commit 281681a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion js/foundation.dropdownMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,20 @@ class DropdownMenu extends Plugin {
if ($elem.attr('data-is-click') === 'true' && _this.options.clickOpen) { return false; }

clearTimeout($elem.data('_delay'));
$elem.data('_delay', setTimeout(function() {
$elem.data('_delay', setTimeout(function () {

// Ignore "magic mouseleave": when the mouse simply disapear from the document
// (like when entering in browser input suggestions See https://git.io/zf-11410),
// unless we actually left the window (and document lost focus).
//
// In firefox, document will not focus at the time the event is triggered, so we have
// to make this test after the delay.
if (e.relatedTarget === null && document.hasFocus && document.hasFocus()) { return false; }

_this._hide($elem);

}, _this.options.closingTime));

}
});
}
Expand Down

0 comments on commit 281681a

Please sign in to comment.