Menu: Fixed issue with touch devices where ending the scroll gesture on the offcanvas menu would trigger the expansion of a parent menu item (fixes #1620)

This commit is contained in:
Djamil Legato
2017-06-29 11:36:10 -07:00
parent 459d9dbb6e
commit 5855de150e
3 changed files with 35 additions and 2 deletions
+17 -1
View File
@@ -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;
}