From: Nicolas Coden Date: Sun, 25 Mar 2018 17:32:52 +0000 (+0200) Subject: fix: prevent dropdownMenu to reopen after being closed on touch X-Git-Tag: v6.6.0~3^2~257^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8fdbe51387f25fc79fbf23dba1bbcddefd62e2ee;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: prevent dropdownMenu to reopen after being closed on touch When a dropdownMenu is closed by taping on its item, a timeout to open the dropdown on hover after a delay is still set, and the dropdown will reopen. Changes: * clean the active item `_delay` when the dropdownMenu is closed --- diff --git a/js/foundation.dropdownMenu.js b/js/foundation.dropdownMenu.js index 6282cd2a2..a0be51143 100644 --- a/js/foundation.dropdownMenu.js +++ b/js/foundation.dropdownMenu.js @@ -348,7 +348,8 @@ class DropdownMenu extends Plugin { var somethingToClose = $toClose.hasClass('is-active') || $toClose.find('.is-active').length > 0; if (somethingToClose) { - $toClose.find('li.is-active').add($toClose).attr({ + var $activeItem = $toClose.find('li.is-active'); + $activeItem.add($toClose).attr({ 'data-is-click': false }).removeClass('is-active'); @@ -361,6 +362,8 @@ class DropdownMenu extends Plugin { .addClass(`opens-${oldClass}`); this.changed = false; } + + clearTimeout($activeItem.data('_delay')); this._removeBodyHandler(); /**