From 964aefada2d9a193c09c34c583191a5c71a086ab Mon Sep 17 00:00:00 2001 From: Prakash Prajapati Date: Fri, 14 Jul 2017 19:00:33 +0530 Subject: [PATCH] [IMP] web_tour: close tip on click on touch devices Task #34856 --- addons/web_tour/static/src/js/tip.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/addons/web_tour/static/src/js/tip.js b/addons/web_tour/static/src/js/tip.js index 8fb5fe49ffd..79a4d1cf11e 100644 --- a/addons/web_tour/static/src/js/tip.js +++ b/addons/web_tour/static/src/js/tip.js @@ -1,12 +1,14 @@ odoo.define('web_tour.Tip', function(require) { "use strict"; +var config = require('web.config'); var core = require('web.core'); var Widget = require('web.Widget'); var Tip = Widget.extend({ template: "Tip", events: { + click: '_onTipClicked', mouseenter: "_to_info_mode", mouseleave: "_to_bubble_mode", }, @@ -260,6 +262,21 @@ var Tip = Widget.extend({ margin: 0, }); }, + + //-------------------------------------------------------------------------- + // Handlers + //-------------------------------------------------------------------------- + + /** + * On touch devices, closes the tip when clicked. + * + * @private + */ + _onTipClicked: function () { + if (config.device.touch && this.tip_opened) { + this._to_bubble_mode(); + } + }, }); Tip.getConsumeEventType = function ($element) {