From 8136677498419835c354d455c7cdd6f89179a4d0 Mon Sep 17 00:00:00 2001 From: tomusborne Date: Mon, 24 Jun 2019 10:38:19 -0700 Subject: [PATCH 1/3] Fix dropdown menu touch issue when dropdown click is active --- js/a11y.js | 7 +++++-- js/a11y.min.js | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/js/a11y.js b/js/a11y.js index 3086b2d8..5af98c9a 100644 --- a/js/a11y.js +++ b/js/a11y.js @@ -85,7 +85,7 @@ /** * Make hover dropdown touch-friendly. */ - if ( 'ontouchend' in document.documentElement ) { + if ( 'ontouchend' in document.documentElement && document.body.classList.contains( 'dropdown-hover' ) ) { var parentElements = document.querySelectorAll( '.sf-menu .menu-item-has-children' ); for ( var i = 0; i < parentElements.length; i++ ) { @@ -119,10 +119,13 @@ this.classList.add( 'sfHover' ); // Hide dropdown on touch outside + var closeDropdown, + thisItem = this; + document.addEventListener( 'touchend', closeDropdown = function(e) { e.stopPropagation(); - this.classList.remove( 'sfHover' ); + thisItem.classList.remove( 'sfHover' ); document.removeEventListener( 'touchend', closeDropdown ); } ); } diff --git a/js/a11y.min.js b/js/a11y.min.js index 4ff8e119..fd31cec5 100644 --- a/js/a11y.min.js +++ b/js/a11y.min.js @@ -1 +1 @@ -/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var e,t=location.hash.substring(1);/^[A-z0-9_-]+$/.test(t)&&(e=document.getElementById(t))&&(/^(?:a|select|input|button|textarea)$/i.test(e.tagName)||(e.tabIndex=-1),e.focus())},!1),function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var e=document.body;e.addEventListener("mousedown",function(){e.classList.add("using-mouse")}),e.addEventListener("keydown",function(){e.classList.remove("using-mouse")})}}(),function(){"use strict";if("querySelector"in document&&"addEventListener"in window&&document.body.classList.contains("dropdown-hover"))for(var e=document.querySelectorAll("nav .main-nav ul a"),t=function(){if(!this.closest("nav").classList.contains("toggled")&&!this.closest("nav").classList.contains("slideout-navigation"))for(var e=this;-1===e.className.indexOf("main-nav");)"li"===e.tagName.toLowerCase()&&(-1!==e.className.indexOf("sfHover")?e.className=e.className.replace(" sfHover",""):e.className+=" sfHover"),e=e.parentElement},s=0;s Date: Mon, 24 Jun 2019 11:09:16 -0700 Subject: [PATCH 2/3] Fix first touch dropdown when tapping child menu items --- js/a11y.js | 2 +- js/a11y.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/a11y.js b/js/a11y.js index 5af98c9a..5baea333 100644 --- a/js/a11y.js +++ b/js/a11y.js @@ -130,7 +130,7 @@ } ); } } - }, true ); + } ); } } diff --git a/js/a11y.min.js b/js/a11y.min.js index fd31cec5..64dad3c9 100644 --- a/js/a11y.min.js +++ b/js/a11y.min.js @@ -1 +1 @@ -/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var e,t=location.hash.substring(1);/^[A-z0-9_-]+$/.test(t)&&(e=document.getElementById(t))&&(/^(?:a|select|input|button|textarea)$/i.test(e.tagName)||(e.tabIndex=-1),e.focus())},!1),function(){"use strict";if("querySelector"in document&&"addEventListener"in window){var e=document.body;e.addEventListener("mousedown",function(){e.classList.add("using-mouse")}),e.addEventListener("keydown",function(){e.classList.remove("using-mouse")})}}(),function(){"use strict";if("querySelector"in document&&"addEventListener"in window&&document.body.classList.contains("dropdown-hover"))for(var e=document.querySelectorAll("nav .main-nav ul a"),t=function(){if(!this.closest("nav").classList.contains("toggled")&&!this.closest("nav").classList.contains("slideout-navigation"))for(var e=this;-1===e.className.indexOf("main-nav");)"li"===e.tagName.toLowerCase()&&(-1!==e.className.indexOf("sfHover")?e.className=e.className.replace(" sfHover",""):e.className+=" sfHover"),e=e.parentElement},s=0;s Date: Tue, 25 Jun 2019 10:14:51 -0700 Subject: [PATCH 3/3] 2.3.1 --- functions.php | 2 +- readme.txt | 8 +++++++- style.css | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/functions.php b/functions.php index 42af5feb..113d4deb 100644 --- a/functions.php +++ b/functions.php @@ -12,7 +12,7 @@ } // Set our theme version. -define( 'GENERATE_VERSION', '2.3' ); +define( 'GENERATE_VERSION', '2.3.1' ); if ( ! function_exists( 'generate_setup' ) ) { add_action( 'after_setup_theme', 'generate_setup' ); diff --git a/readme.txt b/readme.txt index 51e9fe59..3aa7fe4f 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ License URI: https://www.gnu.org/licenses/gpl-2.0.html Tags: two-columns, three-columns, one-column, right-sidebar, left-sidebar, footer-widgets, blog, e-commerce, flexible-header, full-width-template, buddypress, custom-header, custom-background, custom-menu, custom-colors, sticky-post, threaded-comments, translation-ready, rtl-language-support, featured-images, theme-options Requires at least: 4.5 Tested up to: 5.2 -Stable tag: 2.3 +Stable tag: 2.3.1 GeneratePress is a lightweight WordPress theme built with a focus on speed and usability. @@ -95,6 +95,12 @@ MIT License: https://github.com/bgrins/TinyColor/blob/master/LICENSE == Changelog == += 2.3.1 = + +Release date: June 25, 2019 + +* Fix: Touch issue with sub-menus using "Click - Menu Item" option + = 2.3 = Release date: June 18, 2019 diff --git a/style.css b/style.css index c4009b5a..c4967ecf 100644 --- a/style.css +++ b/style.css @@ -4,7 +4,7 @@ Theme URI: https://generatepress.com Author: Tom Usborne Author URI: https://tomusborne.com Description: GeneratePress is a lightweight WordPress theme built with a focus on speed and usability. Performance is important to us, which is why a fresh GeneratePress install adds less than 15kb (gzipped) to your page size. We take full advantage of the new block editor (Gutenberg), which gives you more control over creating your content. If you use page builders, GeneratePress is the right theme for you. It is completely compatible with all major page builders, including Beaver Builder and Elementor. Thanks to our emphasis on WordPress coding standards, we can boast full compatibility with all well-coded plugins, including WooCommerce. GeneratePress is fully responsive, uses valid HTML/CSS and is translated into over 25 languages by our amazing community of users. A few of our many features include microdata integration, 9 widget areas, 5 navigation locations, 5 sidebar layouts, dropdown menus (click or hover) and navigation color presets. Learn more and check out our powerful premium version at https://generatepress.com -Version: 2.3 +Version: 2.3.1 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: generatepress