From aa8a719049177422313bf0ffd86afaf2c7197dd5 Mon Sep 17 00:00:00 2001 From: "Kiet.Chan" Date: Wed, 11 Dec 2019 13:56:13 +0700 Subject: [PATCH] MDL-67417 theme_boost: Tooltip icon stop working after closing using ESC --- theme/boost/amd/build/loader.min.js | 2 +- theme/boost/amd/build/loader.min.js.map | 2 +- theme/boost/amd/src/loader.js | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/theme/boost/amd/build/loader.min.js b/theme/boost/amd/build/loader.min.js index 80080389b57..2b710fcdf17 100644 --- a/theme/boost/amd/build/loader.min.js +++ b/theme/boost/amd/build/loader.min.js @@ -1,2 +1,2 @@ -define ("theme_boost/loader",["jquery","./tether","core/event","core/custom_interaction_events"],function(a,b,c,d){window.jQuery=a;window.Tether=b;M.util.js_pending("theme_boost/loader:children");require(["theme_boost/aria","theme_boost/pending","theme_boost/util","theme_boost/alert","theme_boost/button","theme_boost/carousel","theme_boost/collapse","theme_boost/dropdown","theme_boost/modal","theme_boost/scrollspy","theme_boost/tab","theme_boost/tooltip","theme_boost/popover"],function(b){a("body").popover({trigger:"focus",selector:"[data-toggle=popover][data-trigger!=hover]"});d.define(a("body"),[d.events.escape]);a("body").on(d.events.escape,"[data-toggle=popover]",function(){a(this).popover("hide")});a("html").popover({container:"body",selector:"[data-toggle=popover][data-trigger=hover]",trigger:"hover",delay:{hide:500}});a("html").tooltip({selector:"[data-toggle=\"tooltip\"]"});a.fn.dropdown.Constructor.Default.flip=!1;a("a[data-toggle=\"tab\"]").on("shown.bs.tab",function(b){var c=a(b.target).attr("href");if(history.replaceState){history.replaceState(null,null,c)}else{location.hash=c}});var e=window.location.hash;if(e){a(".nav-link[href=\""+e+"\"]").tab("show")}c.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,function(){a("body").popover({selector:"[data-toggle=\"popover\"]",trigger:"focus"})})});b.init();M.util.js_complete("theme_boost/loader:children")});return{}}); +define ("theme_boost/loader",["jquery","./tether","core/event","core/custom_interaction_events"],function(a,b,c,d){window.jQuery=a;window.Tether=b;M.util.js_pending("theme_boost/loader:children");require(["theme_boost/aria","theme_boost/pending","theme_boost/util","theme_boost/alert","theme_boost/button","theme_boost/carousel","theme_boost/collapse","theme_boost/dropdown","theme_boost/modal","theme_boost/scrollspy","theme_boost/tab","theme_boost/tooltip","theme_boost/popover"],function(b){a("body").popover({trigger:"focus",selector:"[data-toggle=popover][data-trigger!=hover]"});d.define(a("body"),[d.events.escape]);a("body").on(d.events.escape,"[data-toggle=popover]",function(){a(this).trigger("blur")});a("html").popover({container:"body",selector:"[data-toggle=popover][data-trigger=hover]",trigger:"hover",delay:{hide:500}});a("html").tooltip({selector:"[data-toggle=\"tooltip\"]"});a.fn.dropdown.Constructor.Default.flip=!1;a("a[data-toggle=\"tab\"]").on("shown.bs.tab",function(b){var c=a(b.target).attr("href");if(history.replaceState){history.replaceState(null,null,c)}else{location.hash=c}});var e=window.location.hash;if(e){a(".nav-link[href=\""+e+"\"]").tab("show")}c.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,function(){a("body").popover({selector:"[data-toggle=\"popover\"]",trigger:"focus"})})});b.init();M.util.js_complete("theme_boost/loader:children")});return{}}); //# sourceMappingURL=loader.min.js.map diff --git a/theme/boost/amd/build/loader.min.js.map b/theme/boost/amd/build/loader.min.js.map index 89b44109cdc..f3c1ad499c0 100644 --- a/theme/boost/amd/build/loader.min.js.map +++ b/theme/boost/amd/build/loader.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/loader.js"],"names":["define","jQuery","Tether","Event","customEvents","window","M","util","js_pending","require","Aria","popover","trigger","selector","events","escape","on","container","delay","hide","tooltip","fn","dropdown","Constructor","Default","flip","e","hash","target","attr","history","replaceState","location","tab","getLegacyEvents","done","document","FILTER_CONTENT_UPDATED","init","js_complete"],"mappings":"AAyBAA,OAAM,sBAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,YAAvB,CAAqC,gCAArC,CAAD,CA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Be,EAA/B,CAAkC,cAAlC,CAAkD,SAASU,CAAT,CAAY,CAC1D,GAAIC,CAAAA,CAAI,CAAG1B,CAAM,CAACyB,CAAC,CAACE,MAAH,CAAN,CAAiBC,IAAjB,CAAsB,MAAtB,CAAX,CACA,GAAIC,OAAO,CAACC,YAAZ,CAA0B,CACtBD,OAAO,CAACC,YAAR,CAAqB,IAArB,CAA2B,IAA3B,CAAiCJ,CAAjC,CACH,CAFD,IAEO,CACHK,QAAQ,CAACL,IAAT,CAAgBA,CACnB,CACJ,CAPD,EASA,GAAIA,CAAAA,CAAI,CAAGtB,MAAM,CAAC2B,QAAP,CAAgBL,IAA3B,CACA,GAAIA,CAAJ,CAAU,CACP1B,CAAM,CAAC,oBAAqB0B,CAArB,CAA4B,KAA7B,CAAN,CAAyCM,GAAzC,CAA6C,MAA7C,CACF,CAGD9B,CAAK,CAAC+B,eAAN,GAAwBC,IAAxB,CAA6B,SAASrB,CAAT,CAAiB,CAC1Cb,CAAM,CAACmC,QAAD,CAAN,CAAiBpB,EAAjB,CAAoBF,CAAM,CAACuB,sBAA3B,CAAmD,UAAW,CAC1DpC,CAAM,CAAC,MAAD,CAAN,CAAeU,OAAf,CAAuB,CACnBE,QAAQ,CAAE,2BADS,CAEnBD,OAAO,CAAE,OAFU,CAAvB,CAKH,CAND,CAOH,CARD,EAUAF,CAAI,CAAC4B,IAAL,GACAhC,CAAC,CAACC,IAAF,CAAOgC,WAAP,CAAmB,6BAAnB,CACH,CAxEM,CAAP,CA2EA,MAAO,EACV,CAlFK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Template renderer for Moodle. Load and render Moodle templates with Mustache.\n *\n * @module core/templates\n * @package core\n * @class templates\n * @copyright 2015 Damyon Wiese \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 2.9\n */\ndefine(['jquery', './tether', 'core/event', 'core/custom_interaction_events'], function(jQuery, Tether, Event, customEvents) {\n\n window.jQuery = jQuery;\n window.Tether = Tether;\n M.util.js_pending('theme_boost/loader:children');\n\n require(['theme_boost/aria',\n 'theme_boost/pending',\n 'theme_boost/util',\n 'theme_boost/alert',\n 'theme_boost/button',\n 'theme_boost/carousel',\n 'theme_boost/collapse',\n 'theme_boost/dropdown',\n 'theme_boost/modal',\n 'theme_boost/scrollspy',\n 'theme_boost/tab',\n 'theme_boost/tooltip',\n 'theme_boost/popover'],\n function(Aria) {\n\n // We do twice because: https://github.com/twbs/bootstrap/issues/10547\n jQuery('body').popover({\n trigger: 'focus',\n selector: \"[data-toggle=popover][data-trigger!=hover]\"\n });\n\n // Popovers must close on Escape for accessibility reasons.\n customEvents.define(jQuery('body'), [\n customEvents.events.escape,\n ]);\n jQuery('body').on(customEvents.events.escape, '[data-toggle=popover]', function() {\n jQuery(this).popover('hide');\n });\n\n jQuery(\"html\").popover({\n container: \"body\",\n selector: \"[data-toggle=popover][data-trigger=hover]\",\n trigger: \"hover\",\n delay: {\n hide: 500\n }\n });\n\n jQuery(\"html\").tooltip({\n selector: '[data-toggle=\"tooltip\"]'\n });\n\n // Disables flipping the dropdowns up and getting hidden behind the navbar.\n jQuery.fn.dropdown.Constructor.Default.flip = false;\n\n jQuery('a[data-toggle=\"tab\"]').on('shown.bs.tab', function(e) {\n var hash = jQuery(e.target).attr('href');\n if (history.replaceState) {\n history.replaceState(null, null, hash);\n } else {\n location.hash = hash;\n }\n });\n\n var hash = window.location.hash;\n if (hash) {\n jQuery('.nav-link[href=\"' + hash + '\"]').tab('show');\n }\n\n // We need to call popover automatically if nodes are added to the page later.\n Event.getLegacyEvents().done(function(events) {\n jQuery(document).on(events.FILTER_CONTENT_UPDATED, function() {\n jQuery('body').popover({\n selector: '[data-toggle=\"popover\"]',\n trigger: 'focus'\n });\n\n });\n });\n\n Aria.init();\n M.util.js_complete('theme_boost/loader:children');\n });\n\n\n return {};\n});\n"],"file":"loader.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/loader.js"],"names":["define","jQuery","Tether","Event","customEvents","window","M","util","js_pending","require","Aria","popover","trigger","selector","events","escape","on","container","delay","hide","tooltip","fn","dropdown","Constructor","Default","flip","e","hash","target","attr","history","replaceState","location","tab","getLegacyEvents","done","document","FILTER_CONTENT_UPDATED","init","js_complete"],"mappings":"AAyBAA,OAAM,sBAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,YAAvB,CAAqC,gCAArC,CAAD,CAAyE,SAASC,CAAT,CAAiBC,CAAjB,CAAyBC,CAAzB,CAAgCC,CAAhC,CAA8C,CAEzHC,MAAM,CAACJ,MAAP,CAAgBA,CAAhB,CACAI,MAAM,CAACH,MAAP,CAAgBA,CAAhB,CACAI,CAAC,CAACC,IAAF,CAAOC,UAAP,CAAkB,6BAAlB,EAEAC,OAAO,CAAC,CAAC,kBAAD,CACA,qBADA,CAEA,kBAFA,CAGA,mBAHA,CAIA,oBAJA,CAKA,sBALA,CAMA,sBANA,CAOA,sBAPA,CAQA,mBARA,CASA,uBATA,CAUA,iBAVA,CAWA,qBAXA,CAYA,qBAZA,CAAD,CAaC,SAASC,CAAT,CAAe,CAGnBT,CAAM,CAAC,MAAD,CAAN,CAAeU,OAAf,CAAuB,CACnBC,OAAO,CAAE,OADU,CAEnBC,QAAQ,CAAE,4CAFS,CAAvB,EAMAT,CAAY,CAACJ,MAAb,CAAoBC,CAAM,CAAC,MAAD,CAA1B,CAAoC,CAChCG,CAAY,CAACU,MAAb,CAAoBC,MADY,CAApC,EAGAd,CAAM,CAAC,MAAD,CAAN,CAAee,EAAf,CAAkBZ,CAAY,CAACU,MAA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AAD,CAAN,CAAeU,OAAf,CAAuB,CACnBE,QAAQ,CAAE,2BADS,CAEnBD,OAAO,CAAE,OAFU,CAAvB,CAKH,CAND,CAOH,CARD,EAUAF,CAAI,CAAC4B,IAAL,GACAhC,CAAC,CAACC,IAAF,CAAOgC,WAAP,CAAmB,6BAAnB,CACH,CAzEM,CAAP,CA4EA,MAAO,EACV,CAnFK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Template renderer for Moodle. Load and render Moodle templates with Mustache.\n *\n * @module core/templates\n * @package core\n * @class templates\n * @copyright 2015 Damyon Wiese \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 2.9\n */\ndefine(['jquery', './tether', 'core/event', 'core/custom_interaction_events'], function(jQuery, Tether, Event, customEvents) {\n\n window.jQuery = jQuery;\n window.Tether = Tether;\n M.util.js_pending('theme_boost/loader:children');\n\n require(['theme_boost/aria',\n 'theme_boost/pending',\n 'theme_boost/util',\n 'theme_boost/alert',\n 'theme_boost/button',\n 'theme_boost/carousel',\n 'theme_boost/collapse',\n 'theme_boost/dropdown',\n 'theme_boost/modal',\n 'theme_boost/scrollspy',\n 'theme_boost/tab',\n 'theme_boost/tooltip',\n 'theme_boost/popover'],\n function(Aria) {\n\n // We do twice because: https://github.com/twbs/bootstrap/issues/10547\n jQuery('body').popover({\n trigger: 'focus',\n selector: \"[data-toggle=popover][data-trigger!=hover]\"\n });\n\n // Popovers must close on Escape for accessibility reasons.\n customEvents.define(jQuery('body'), [\n customEvents.events.escape,\n ]);\n jQuery('body').on(customEvents.events.escape, '[data-toggle=popover]', function() {\n // Use \"blur\" instead of \"popover('hide')\" to prevent issue that the same tooltip can't be opened again.\n jQuery(this).trigger('blur');\n });\n\n jQuery(\"html\").popover({\n container: \"body\",\n selector: \"[data-toggle=popover][data-trigger=hover]\",\n trigger: \"hover\",\n delay: {\n hide: 500\n }\n });\n\n jQuery(\"html\").tooltip({\n selector: '[data-toggle=\"tooltip\"]'\n });\n\n // Disables flipping the dropdowns up and getting hidden behind the navbar.\n jQuery.fn.dropdown.Constructor.Default.flip = false;\n\n jQuery('a[data-toggle=\"tab\"]').on('shown.bs.tab', function(e) {\n var hash = jQuery(e.target).attr('href');\n if (history.replaceState) {\n history.replaceState(null, null, hash);\n } else {\n location.hash = hash;\n }\n });\n\n var hash = window.location.hash;\n if (hash) {\n jQuery('.nav-link[href=\"' + hash + '\"]').tab('show');\n }\n\n // We need to call popover automatically if nodes are added to the page later.\n Event.getLegacyEvents().done(function(events) {\n jQuery(document).on(events.FILTER_CONTENT_UPDATED, function() {\n jQuery('body').popover({\n selector: '[data-toggle=\"popover\"]',\n trigger: 'focus'\n });\n\n });\n });\n\n Aria.init();\n M.util.js_complete('theme_boost/loader:children');\n });\n\n\n return {};\n});\n"],"file":"loader.min.js"} \ No newline at end of file diff --git a/theme/boost/amd/src/loader.js b/theme/boost/amd/src/loader.js index ecc0d123f6e..a81bc8d6130 100644 --- a/theme/boost/amd/src/loader.js +++ b/theme/boost/amd/src/loader.js @@ -55,7 +55,8 @@ define(['jquery', './tether', 'core/event', 'core/custom_interaction_events'], f customEvents.events.escape, ]); jQuery('body').on(customEvents.events.escape, '[data-toggle=popover]', function() { - jQuery(this).popover('hide'); + // Use "blur" instead of "popover('hide')" to prevent issue that the same tooltip can't be opened again. + jQuery(this).trigger('blur'); }); jQuery("html").popover({