diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fd645ce9..dc233ac2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Menu: Disable Dropdowns still Shows Indicator (#2031) - Menu: Fixed frontend menu 'Extended' option, resetting heights of wrapping containers not necessarily related to the menu itself (#2025) - Menu / Offcanvas: Fixed issue preventing the offcanvas toggle to show when Menu set with only icons (#1939) + - Menu: Fixed issue with touch devices where ending the scroll gesture on the offcanvas menu would trigger the expansion of a parent menu item (#1620) - Fixed Tag Attributes 'enter' key causing the value to get lost while triggering the Apply (#1860) - Filepicker: Fixed issue with upper case extensions not getting recognized and failing to upload (#1852) 3. [WordPress](#wordpress) diff --git a/assets/common/application/menu/index.js b/assets/common/application/menu/index.js index 14f9f9b7c..6adf27314 100644 --- a/assets/common/application/menu/index.js +++ b/assets/common/application/menu/index.js @@ -78,7 +78,10 @@ var Menu = new prime({ if (hasTouchEvents || !this.hoverExpand) { var linkedParent = $(selectors.linkedParent); - if (linkedParent) { linkedParent.on('touchend', this.bound('touchend')); } + if (linkedParent) { + linkedParent.on('touchmove', this.bound('touchmove')); + linkedParent.on('touchend', this.bound('touchend')); + } this.overlay.on('touchend', this.bound('closeAllDropdowns')); } @@ -125,6 +128,11 @@ var Menu = new prime({ this.closeDropdown(element); }, + touchmove: function(event) { + var target = $(event.target); + target.isMoving = true; + }, + touchend: function(event) { var selectors = this.selectors, states = this.states; @@ -135,6 +143,14 @@ var Menu = new prime({ isGoingBack = target.parent('.g-go-back'), parent, isSelected; + if (target.isMoving) { + target.isMoving = false; + return false; + } + + target.off('touchmove', this.bound('touchmove')); + target.isMoving = false; + if (indicator) { target = indicator; } diff --git a/assets/common/js/main.js b/assets/common/js/main.js index 454da439c..b24ecd7be 100644 --- a/assets/common/js/main.js +++ b/assets/common/js/main.js @@ -104,7 +104,10 @@ var Menu = new prime({ if (hasTouchEvents || !this.hoverExpand) { var linkedParent = $(selectors.linkedParent); - if (linkedParent) { linkedParent.on('touchend', this.bound('touchend')); } + if (linkedParent) { + linkedParent.on('touchmove', this.bound('touchmove')); + linkedParent.on('touchend', this.bound('touchend')); + } this.overlay.on('touchend', this.bound('closeAllDropdowns')); } @@ -151,6 +154,11 @@ var Menu = new prime({ this.closeDropdown(element); }, + touchmove: function(event) { + var target = $(event.target); + target.isMoving = true; + }, + touchend: function(event) { var selectors = this.selectors, states = this.states; @@ -161,6 +169,14 @@ var Menu = new prime({ isGoingBack = target.parent('.g-go-back'), parent, isSelected; + if (target.isMoving) { + target.isMoving = false; + return false; + } + + target.off('touchmove', this.bound('touchmove')); + target.isMoving = false; + if (indicator) { target = indicator; }