mirror of
https://github.com/moodle/moodle.git
synced 2025-05-01 14:09:01 +02:00
MDL-72481 theme_boost: Find the tab if it is inside the more dropdown
keep the selector limited to tablists to prevent infinite redirects Co-authored-by: Shamim Rezaie <shamim@moodle.com>
This commit is contained in:
parent
af496f2c85
commit
044439fc84
2
theme/boost/amd/build/loader.min.js
vendored
2
theme/boost/amd/build/loader.min.js
vendored
@ -6,6 +6,6 @@ define("theme_boost/loader",["exports","jquery","./aria","./index","core/pending
|
||||
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since 2.9
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),Object.defineProperty(_exports,"Bootstrap",{enumerable:!0,get:function(){return _index.default}}),_jquery=_interopRequireDefault(_jquery),Aria=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(Aria),_index=_interopRequireDefault(_index),_pending=_interopRequireDefault(_pending),_pending2=_interopRequireDefault(_pending2);const pendingPromise=new _pending.default("theme_boost/loader:init");(0,_pending2.default)(),Aria.init(),(()=>{(0,_jquery.default)('a[data-toggle="tab"]').on("shown.bs.tab",(function(e){var hash=(0,_jquery.default)(e.target).attr("href");history.replaceState?history.replaceState(null,null,hash):location.hash=hash}));const hash=window.location.hash;if(hash){const tab=document.querySelector('.nav-link[href="'+hash+'"]');tab&&tab.click()}})(),(0,_jquery.default)("body").popover({container:"body",selector:'[data-toggle="popover"]',trigger:"focus"}),document.addEventListener("keydown",(e=>{"Escape"===e.key&&e.target.closest('[data-toggle="popover"]')&&(0,_jquery.default)(e.target).popover("hide")})),(0,_jquery.default)("body").tooltip({container:"body",selector:'[data-toggle="tooltip"]'}),_jquery.default.fn.dropdown.Constructor.Default.flip=!1,pendingPromise.resolve()}));
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),Object.defineProperty(_exports,"Bootstrap",{enumerable:!0,get:function(){return _index.default}}),_jquery=_interopRequireDefault(_jquery),Aria=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(Aria),_index=_interopRequireDefault(_index),_pending=_interopRequireDefault(_pending),_pending2=_interopRequireDefault(_pending2);const pendingPromise=new _pending.default("theme_boost/loader:init");(0,_pending2.default)(),Aria.init(),(()=>{(0,_jquery.default)('a[data-toggle="tab"]').on("shown.bs.tab",(function(e){var hash=(0,_jquery.default)(e.target).attr("href");history.replaceState?history.replaceState(null,null,hash):location.hash=hash}));const hash=window.location.hash;if(hash){const tab=document.querySelector('[role="tablist"] [href="'+hash+'"]');tab&&tab.click()}})(),(0,_jquery.default)("body").popover({container:"body",selector:'[data-toggle="popover"]',trigger:"focus"}),document.addEventListener("keydown",(e=>{"Escape"===e.key&&e.target.closest('[data-toggle="popover"]')&&(0,_jquery.default)(e.target).popover("hide")})),(0,_jquery.default)("body").tooltip({container:"body",selector:'[data-toggle="tooltip"]'}),_jquery.default.fn.dropdown.Constructor.Default.flip=!1,pendingPromise.resolve()}));
|
||||
|
||||
//# sourceMappingURL=loader.min.js.map
|
@ -1 +1 @@
|
||||
{"version":3,"file":"loader.min.js","sources":["../src/loader.js"],"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 <http://www.gnu.org/licenses/>.\n\n/**\n * Template renderer for Moodle. Load and render Moodle templates with Mustache.\n *\n * @module theme_boost/loader\n * @copyright 2015 Damyon Wiese <damyon@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 2.9\n */\n\nimport $ from 'jquery';\nimport * as Aria from './aria';\nimport Bootstrap from './index';\nimport Pending from 'core/pending';\nimport setupBootstrapPendingChecks from './pending';\n\n/**\n * Rember the last visited tabs.\n */\nconst rememberTabs = () => {\n $('a[data-toggle=\"tab\"]').on('shown.bs.tab', function(e) {\n var hash = $(e.target).attr('href');\n if (history.replaceState) {\n history.replaceState(null, null, hash);\n } else {\n location.hash = hash;\n }\n });\n const hash = window.location.hash;\n if (hash) {\n const tab = document.querySelector('.nav-link[href=\"' + hash + '\"]');\n if (tab) {\n tab.click();\n }\n }\n};\n\n/**\n * Enable all popovers\n *\n */\nconst enablePopovers = () => {\n $('body').popover({\n container: 'body',\n selector: '[data-toggle=\"popover\"]',\n trigger: 'focus',\n });\n\n document.addEventListener('keydown', e => {\n if (e.key === 'Escape' && e.target.closest('[data-toggle=\"popover\"]')) {\n $(e.target).popover('hide');\n }\n });\n};\n\n/**\n * Enable tooltips\n *\n */\nconst enableTooltips = () => {\n $('body').tooltip({\n container: 'body',\n selector: '[data-toggle=\"tooltip\"]',\n });\n};\n\nconst pendingPromise = new Pending('theme_boost/loader:init');\n\n// Add pending promise event listeners to relevant Bootstrap custom events.\nsetupBootstrapPendingChecks();\n\n// Setup Aria helpers for Bootstrap features.\nAria.init();\n\n// Remember the last visited tabs.\nrememberTabs();\n\n// Enable all popovers.\nenablePopovers();\n\n// Enable all tooltips.\nenableTooltips();\n\n// Disables flipping the dropdowns up and getting hidden behind the navbar.\n$.fn.dropdown.Constructor.Default.flip = false;\n\npendingPromise.resolve();\n\nexport {\n Bootstrap,\n};\n"],"names":["pendingPromise","Pending","Aria","init","on","e","hash","target","attr","history","replaceState","location","window","tab","document","querySelector","click","rememberTabs","popover","container","selector","trigger","addEventListener","key","closest","tooltip","fn","dropdown","Constructor","Default","flip","resolve"],"mappings":";;;;;;;;i+BAgFMA,eAAiB,IAAIC,iBAAQ,mDAMnCC,KAAKC,OArDgB,0BACf,wBAAwBC,GAAG,gBAAgB,SAASC,OAC9CC,MAAO,mBAAED,EAAEE,QAAQC,KAAK,QACxBC,QAAQC,aACRD,QAAQC,aAAa,KAAM,KAAMJ,MAEjCK,SAASL,KAAOA,cAGlBA,KAAOM,OAAOD,SAASL,QACzBA,KAAM,OACAO,IAAMC,SAASC,cAAc,mBAAqBT,KAAO,MAC3DO,KACAA,IAAIG,UA2ChBC,uBAjCM,QAAQC,QAAQ,CACdC,UAAW,OACXC,SAAU,0BACVC,QAAS,UAGbP,SAASQ,iBAAiB,WAAWjB,IACnB,WAAVA,EAAEkB,KAAoBlB,EAAEE,OAAOiB,QAAQ,gDACrCnB,EAAEE,QAAQW,QAAQ,+BAU1B,QAAQO,QAAQ,CACdN,UAAW,OACXC,SAAU,4CAsBhBM,GAAGC,SAASC,YAAYC,QAAQC,MAAO,EAEzC9B,eAAe+B"}
|
||||
{"version":3,"file":"loader.min.js","sources":["../src/loader.js"],"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 <http://www.gnu.org/licenses/>.\n\n/**\n * Template renderer for Moodle. Load and render Moodle templates with Mustache.\n *\n * @module theme_boost/loader\n * @copyright 2015 Damyon Wiese <damyon@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 2.9\n */\n\nimport $ from 'jquery';\nimport * as Aria from './aria';\nimport Bootstrap from './index';\nimport Pending from 'core/pending';\nimport setupBootstrapPendingChecks from './pending';\n\n/**\n * Rember the last visited tabs.\n */\nconst rememberTabs = () => {\n $('a[data-toggle=\"tab\"]').on('shown.bs.tab', function(e) {\n var hash = $(e.target).attr('href');\n if (history.replaceState) {\n history.replaceState(null, null, hash);\n } else {\n location.hash = hash;\n }\n });\n const hash = window.location.hash;\n if (hash) {\n const tab = document.querySelector('[role=\"tablist\"] [href=\"' + hash + '\"]');\n if (tab) {\n tab.click();\n }\n }\n};\n\n/**\n * Enable all popovers\n *\n */\nconst enablePopovers = () => {\n $('body').popover({\n container: 'body',\n selector: '[data-toggle=\"popover\"]',\n trigger: 'focus',\n });\n\n document.addEventListener('keydown', e => {\n if (e.key === 'Escape' && e.target.closest('[data-toggle=\"popover\"]')) {\n $(e.target).popover('hide');\n }\n });\n};\n\n/**\n * Enable tooltips\n *\n */\nconst enableTooltips = () => {\n $('body').tooltip({\n container: 'body',\n selector: '[data-toggle=\"tooltip\"]',\n });\n};\n\nconst pendingPromise = new Pending('theme_boost/loader:init');\n\n// Add pending promise event listeners to relevant Bootstrap custom events.\nsetupBootstrapPendingChecks();\n\n// Setup Aria helpers for Bootstrap features.\nAria.init();\n\n// Remember the last visited tabs.\nrememberTabs();\n\n// Enable all popovers.\nenablePopovers();\n\n// Enable all tooltips.\nenableTooltips();\n\n// Disables flipping the dropdowns up and getting hidden behind the navbar.\n$.fn.dropdown.Constructor.Default.flip = false;\n\npendingPromise.resolve();\n\nexport {\n Bootstrap,\n};\n"],"names":["pendingPromise","Pending","Aria","init","on","e","hash","target","attr","history","replaceState","location","window","tab","document","querySelector","click","rememberTabs","popover","container","selector","trigger","addEventListener","key","closest","tooltip","fn","dropdown","Constructor","Default","flip","resolve"],"mappings":";;;;;;;;i+BAgFMA,eAAiB,IAAIC,iBAAQ,mDAMnCC,KAAKC,OArDgB,0BACf,wBAAwBC,GAAG,gBAAgB,SAASC,OAC9CC,MAAO,mBAAED,EAAEE,QAAQC,KAAK,QACxBC,QAAQC,aACRD,QAAQC,aAAa,KAAM,KAAMJ,MAEjCK,SAASL,KAAOA,cAGlBA,KAAOM,OAAOD,SAASL,QACzBA,KAAM,OACAO,IAAMC,SAASC,cAAc,2BAA6BT,KAAO,MACnEO,KACAA,IAAIG,UA2ChBC,uBAjCM,QAAQC,QAAQ,CACdC,UAAW,OACXC,SAAU,0BACVC,QAAS,UAGbP,SAASQ,iBAAiB,WAAWjB,IACnB,WAAVA,EAAEkB,KAAoBlB,EAAEE,OAAOiB,QAAQ,gDACrCnB,EAAEE,QAAQW,QAAQ,+BAU1B,QAAQO,QAAQ,CACdN,UAAW,OACXC,SAAU,4CAsBhBM,GAAGC,SAASC,YAAYC,QAAQC,MAAO,EAEzC9B,eAAe+B"}
|
@ -42,7 +42,7 @@ const rememberTabs = () => {
|
||||
});
|
||||
const hash = window.location.hash;
|
||||
if (hash) {
|
||||
const tab = document.querySelector('.nav-link[href="' + hash + '"]');
|
||||
const tab = document.querySelector('[role="tablist"] [href="' + hash + '"]');
|
||||
if (tab) {
|
||||
tab.click();
|
||||
}
|
||||
|
@ -86,7 +86,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
/* TODO: MDL-72481: Update this style to also apply to aria-selected. */
|
||||
|
||||
.dropdown-item[aria-current="true"],
|
||||
.dropdown-item.active {
|
||||
background-color: transparent;
|
||||
|
@ -21469,8 +21469,7 @@ div.editor_atto_toolbar button .icon {
|
||||
|
||||
.moremenu {
|
||||
opacity: 0;
|
||||
height: 60px;
|
||||
/* TODO: MDL-72481: Update this style to also apply to aria-selected. */ }
|
||||
height: 60px; }
|
||||
.moremenu.observed {
|
||||
opacity: 1; }
|
||||
.moremenu .nav-link {
|
||||
|
@ -21415,8 +21415,7 @@ div.editor_atto_toolbar button .icon {
|
||||
|
||||
.moremenu {
|
||||
opacity: 0;
|
||||
height: 50px;
|
||||
/* TODO: MDL-72481: Update this style to also apply to aria-selected. */ }
|
||||
height: 50px; }
|
||||
.moremenu.observed {
|
||||
opacity: 1; }
|
||||
.moremenu .nav-link {
|
||||
|
Loading…
x
Reference in New Issue
Block a user