summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authormgh-odoo <mgh@odoo.com>2019-11-19 11:28:33 +0000
committerAaron Bohy <aab@odoo.com>2019-11-25 13:58:22 +0000
commit67044d64cdee723515c14ebc62575644d7c37b47 (patch)
tree132069c19a7233f36c3270bae61f9d2ba756d4f1 /addons
parent441c8b0e0d544127c299d00191a24f3cc857dde7 (diff)
[FIX] web_tour: consume tip with drag and drop
After the rainbowMan issue was fixed here: e5bc2e7, steps were consumed on 'click' events. This caused an issue with the drag and drop event (which breaks tour, because it is expecting a click event). If the user dragged an element, thetip was not getting consumed as no click event was triggered. closes odoo/odoo#40819 X-original-commit: 3f458fe06e6a629edc72428eab749068c2eba1ba Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Priyanka Kakadiya <pka@odoo.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/web_tour/static/src/js/tip.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/addons/web_tour/static/src/js/tip.js b/addons/web_tour/static/src/js/tip.js
index 5bd64ce1c49..e299df9b538 100644
--- a/addons/web_tour/static/src/js/tip.js
+++ b/addons/web_tour/static/src/js/tip.js
@@ -178,7 +178,14 @@ var Tip = Widget.extend({
},
_bind_anchor_events: function () {
this.consume_event = Tip.getConsumeEventType(this.$anchor);
- this.$anchor.on(this.consume_event + ".anchor", (function (e) {
+ this.$consumeEventAnchor = this.$anchor;
+ // jQuery-ui draggable triggers 'drag' events on the .ui-draggable element,
+ // but the tip is attached to the .ui-draggable-handle element which may
+ // be one of its children (or the element itself)
+ if (this.consume_event === "drag") {
+ this.$consumeEventAnchor = this.$anchor.closest('.ui-draggable');
+ }
+ this.$consumeEventAnchor.on(this.consume_event + ".anchor", (function (e) {
if (e.type !== "mousedown" || e.which === 1) { // only left click
this.trigger("tip_consumed");
this._unbind_anchor_events();
@@ -189,6 +196,7 @@ var Tip = Widget.extend({
},
_unbind_anchor_events: function () {
this.$anchor.off(".anchor");
+ this.$consumeEventAnchor.off(".anchor");
},
_get_spaced_inverted_position: function (position) {
if (position === "right") return "left+" + this.info.space;
@@ -305,6 +313,8 @@ Tip.getConsumeEventType = function ($element) {
return !type || !!type.match(/^(email|number|password|search|tel|text|url)$/);
})) {
return "input";
+ } else if ($element.hasClass('ui-draggable-handle')) {
+ return "drag";
}
return "click";
};