From: Nicolas Coden Date: Wed, 1 Aug 2018 21:14:02 +0000 (+0200) Subject: fix: use mobile "tap" for the "closeOnClick" option in Reveal X-Git-Tag: v6.6.0~3^2~85^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3bc49d7a8b77c87de545491bac1e25db3032c83;p=thirdparty%2Ffoundation%2Ffoundation-sites.git fix: use mobile "tap" for the "closeOnClick" option in Reveal BREAKING CHANGE: `foundation.utils.touch.js` is now required for `foundation.reveal.js`. If you import the Foundation Dropdown plugin manually, make sure to import the "Touch" utility as well. --- diff --git a/js/foundation.reveal.js b/js/foundation.reveal.js index b11fba388..acc986ba5 100644 --- a/js/foundation.reveal.js +++ b/js/foundation.reveal.js @@ -31,7 +31,8 @@ class Reveal extends Plugin { this.className = 'Reveal'; // ie9 back compat this._init(); - // Triggers init is idempotent, just need to make sure it is initialized + // Touch and Triggers init are idempotent, just need to make sure they are initialized + Touch.init($); Triggers.init($); Keyboard.register('Reveal', { @@ -160,7 +161,7 @@ class Reveal extends Plugin { }); if (this.options.closeOnClick && this.options.overlay) { - this.$overlay.off('.zf.reveal').on('click.zf.reveal', function(e) { + this.$overlay.off('.zf.reveal').on('click.zf.dropdown tap.zf.dropdown', function(e) { if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target) || !$.contains(document, e.target)) { @@ -365,7 +366,7 @@ class Reveal extends Plugin { this.focusableElements = Keyboard.findFocusable(this.$element); if (!this.options.overlay && this.options.closeOnClick && !this.options.fullScreen) { - $('body').on('click.zf.reveal', function(e) { + $('body').on('click.zf.dropdown tap.zf.dropdown', function(e) { if (e.target === _this.$element[0] || $.contains(_this.$element[0], e.target) || !$.contains(document, e.target)) { return; } @@ -423,7 +424,7 @@ class Reveal extends Plugin { } if (!this.options.overlay && this.options.closeOnClick) { - $('body').off('click.zf.reveal'); + $('body').off('click.zf.dropdown tap.zf.dropdown'); } this.$element.off('keydown.zf.reveal');