diff --git a/theme/boost/amd/build/aria.min.js b/theme/boost/amd/build/aria.min.js index 447fd662e94..e266186de4e 100644 --- a/theme/boost/amd/build/aria.min.js +++ b/theme/boost/amd/build/aria.min.js @@ -1,2 +1,2 @@ -define ("theme_boost/aria",["jquery","core/pending"],function(a,b){return{init:function init(){var c=!1,d=function(){c=!0},e=function(){var a=c;c=!1;return a};a("[data-toggle=\"dropdown\"]").keydown(function(b){var c=b.which||b.keyCode,e;if(38==c){d()}if(27==c){e=a(b.target).attr("aria-expanded");b.preventDefault();if("false"==e){a(b.target).click()}}if(32==c||13==c){b.preventDefault();a(b.target).click()}});var f=function(c){var d=function(b){a(this).focus();b.resolve()}.bind(c);setTimeout(d,50,new b("core/aria:delayed-focus"))};a(".dropdown").on("shown.bs.dropdown",function(b){var c=a(b.target).find("[role=\"menu\"]"),d=!1,g=!1;if(c){d=a(c).find("[role=\"menuitem\"]")}if(d&&0.\n\n/**\n * Enhancements to Bootstrap components for accessibility.\n *\n * @module theme_boost/aria\n * @copyright 2018 Damyon Wiese \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/pending'], function($, Pending) {\n return {\n init: function() {\n // Drop downs from bootstrap don't support keyboard accessibility by default.\n var focusEnd = false,\n setFocusEnd = function() {\n focusEnd = true;\n },\n getFocusEnd = function() {\n var result = focusEnd;\n focusEnd = false;\n return result;\n };\n\n // Special handling for \"up\" keyboard control.\n $('[data-toggle=\"dropdown\"]').keydown(function(e) {\n var trigger = e.which || e.keyCode,\n expanded;\n\n // Up key opens the menu at the end.\n if (trigger == 38) {\n // Focus the end of the menu, not the beginning.\n setFocusEnd();\n }\n\n // Escape key only closes the menu, it doesn't open it.\n if (trigger == 27) {\n expanded = $(e.target).attr('aria-expanded');\n e.preventDefault();\n if (expanded == \"false\") {\n $(e.target).click();\n }\n }\n\n // Space key or Enter key opens the menu.\n if (trigger == 32 || trigger == 13) {\n // Cancel random scroll.\n e.preventDefault();\n // Open the menu instead.\n $(e.target).click();\n }\n });\n\n // Special handling for navigation keys when menu is open.\n var shiftFocus = function(element) {\n var delayedFocus = function(pendingPromise) {\n $(this).focus();\n pendingPromise.resolve();\n }.bind(element);\n setTimeout(delayedFocus, 50, new Pending('core/aria:delayed-focus'));\n };\n\n $('.dropdown').on('shown.bs.dropdown', function(e) {\n // We need to focus on the first menuitem.\n var menu = $(e.target).find('[role=\"menu\"]'),\n menuItems = false,\n foundMenuItem = false;\n\n if (menu) {\n menuItems = $(menu).find('[role=\"menuitem\"]');\n }\n if (menuItems && menuItems.length > 0) {\n if (getFocusEnd()) {\n foundMenuItem = menuItems[menuItems.length - 1];\n } else {\n // The first menu entry, pretty reasonable.\n foundMenuItem = menuItems[0];\n }\n }\n if (foundMenuItem) {\n shiftFocus(foundMenuItem);\n }\n });\n // Search for menu items by finding the first item that has\n // text starting with the typed character (case insensitive).\n $('.dropdown [role=\"menu\"] [role=\"menuitem\"]').keypress(function(e) {\n var trigger = String.fromCharCode(e.which || e.keyCode),\n menu = $(e.target).closest('[role=\"menu\"]'),\n i = 0,\n menuItems = false,\n item,\n itemText;\n\n if (!menu) {\n return;\n }\n menuItems = $(menu).find('[role=\"menuitem\"]');\n if (!menuItems) {\n return;\n }\n\n trigger = trigger.toLowerCase();\n for (i = 0; i < menuItems.length; i++) {\n item = $(menuItems[i]);\n itemText = item.text().trim().toLowerCase();\n if (itemText.indexOf(trigger) == 0) {\n shiftFocus(item);\n break;\n }\n }\n });\n\n // Keyboard navigation for arrow keys, home and end keys.\n $('.dropdown [role=\"menu\"] [role=\"menuitem\"]').keydown(function(e) {\n var trigger = e.which || e.keyCode,\n next = false,\n menu = $(e.target).closest('[role=\"menu\"]'),\n i = 0,\n menuItems = false;\n if (!menu) {\n return;\n }\n menuItems = $(menu).find('[role=\"menuitem\"]');\n if (!menuItems) {\n return;\n }\n // Down key.\n if (trigger == 40) {\n for (i = 0; i < menuItems.length - 1; i++) {\n if (menuItems[i] == e.target) {\n next = menuItems[i + 1];\n break;\n }\n }\n if (!next) {\n // Wrap to first item.\n next = menuItems[0];\n }\n\n } else if (trigger == 38) {\n // Up key.\n for (i = 1; i < menuItems.length; i++) {\n if (menuItems[i] == e.target) {\n next = menuItems[i - 1];\n break;\n }\n }\n if (!next) {\n // Wrap to last item.\n next = menuItems[menuItems.length - 1];\n }\n\n } else if (trigger == 36) {\n // Home key.\n next = menuItems[0];\n\n } else if (trigger == 35) {\n // End key.\n next = menuItems[menuItems.length - 1];\n }\n // Variable next is set if we do want to act on the keypress.\n if (next) {\n e.preventDefault();\n shiftFocus(next);\n }\n return;\n });\n $('.dropdown').on('hidden.bs.dropdown', function(e) {\n // We need to focus on the menu trigger.\n var trigger = $(e.target).find('[data-toggle=\"dropdown\"]');\n if (trigger) {\n shiftFocus(trigger);\n }\n });\n\n // After page load, focus on any element with special autofocus attribute.\n window.addEventListener(\"load\", () => {\n const alerts = document.querySelectorAll('[data-aria-autofocus=\"true\"][role=\"alert\"]');\n Array.prototype.forEach.call(alerts, autofocusElement => {\n // According to the specification an role=\"alert\" region is only read out on change to the content\n // of that region.\n autofocusElement.innerHTML += ' ';\n autofocusElement.removeAttribute('data-aria-autofocus');\n });\n });\n }\n };\n});\n"],"file":"aria.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/aria.js"],"names":["dropdownFix","focusEnd","setFocusEnd","getFocusEnd","result","document","addEventListener","e","target","matches","trigger","which","arrowUp","escape","expanded","getAttribute","preventDefault","click","space","enter","shiftFocus","element","setTimeout","delayedFocus","pendingPromise","focus","resolve","Pending","on","menu","querySelector","menuItems","foundMenuItem","querySelectorAll","length","String","fromCharCode","toLowerCase","closest","i","item","itemText","text","trim","indexOf","next","arrowDown","home","end","autoFocus","window","alerts","Array","prototype","forEach","call","autofocusElement","innerHTML","removeAttribute","init"],"mappings":"8KAwBA,OACA,O,sDAKMA,CAAAA,CAAW,CAAG,UAAM,IAClBC,CAAAA,CAAQ,GADU,CAEhBC,CAAW,CAAG,UAAM,CACtBD,CA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d,CAAS,CAACA,CAAS,CAACG,MAAV,CAAmB,CAApB,CACnB,CAEJ,CAbM,IAaA,IAAIxB,CAAO,EAAIqC,MAAf,CAAqB,CAExBF,CAAI,CAAGd,CAAS,CAAC,CAAD,CAEnB,CAJM,IAIA,IAAIrB,CAAO,EAAIsC,KAAf,CAAoB,CAEvBH,CAAI,CAAGd,CAAS,CAACA,CAAS,CAACG,MAAV,CAAmB,CAApB,CACnB,CAED,GAAIW,CAAJ,CAAU,CACNtC,CAAC,CAACS,cAAF,GACAI,CAAU,CAACyB,CAAD,CACb,CAEJ,CACJ,CAtDD,EAwDA,cAAE,WAAF,EAAejB,EAAf,CAAkB,oBAAlB,CAAwC,SAAArB,CAAC,CAAI,CAEzC,GAAMG,CAAAA,CAAO,CAAGH,CAAC,CAACC,MAAF,CAASsB,aAAT,CAAuB,4BAAvB,CAAhB,CACA,GAAIpB,CAAJ,CAAa,CACTU,CAAU,CAACV,CAAD,CACb,CACJ,CAND,CAOH,C,CAKKuC,CAAS,CAAG,UAAM,CACpBC,MAAM,CAAC5C,gBAAP,CAAwB,MAAxB,CAAgC,UAAM,CAClC,GAAM6C,CAAAA,CAAM,CAAG9C,QAAQ,CAAC4B,gBAAT,CAA0B,gDAA1B,CAAf,CACAmB,KAAK,CAACC,SAAN,CAAgBC,OAAhB,CAAwBC,IAAxB,CAA6BJ,CAA7B,CAAqC,SAAAK,CAAgB,CAAI,CAGrDA,CAAgB,CAACC,SAAjB,EAA8B,GAA9B,CACAD,CAAgB,CAACE,eAAjB,CAAiC,qBAAjC,CACH,CALD,CAMH,CARD,CASH,C,QAEmB,QAAPC,CAAAA,IAAO,EAAM,CACtB3D,CAAW,GACXiD,CAAS,EACZ,C","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 * Enhancements to Bootstrap components for accessibility.\n *\n * @module theme_boost/aria\n * @copyright 2018 Damyon Wiese \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport {end, escape, arrowUp, arrowDown, home, enter, space} from 'core/key_codes';\nimport $ from 'jquery';\nimport Pending from 'core/pending';\n\n/**\n * Drop downs from bootstrap don't support keyboard accessibility by default.\n */\nconst dropdownFix = () => {\n let focusEnd = false;\n const setFocusEnd = () => {\n focusEnd = true;\n };\n const getFocusEnd = () => {\n const result = focusEnd;\n focusEnd = false;\n return result;\n };\n\n // Special handling for \"up\" keyboard control.\n document.addEventListener('keydown', e => {\n if (e.target.matches('[data-toggle=\"dropdown\"]')) {\n const trigger = e.which;\n\n // Up key opens the menu at the end.\n if (trigger == arrowUp) {\n // Focus the end of the menu, not the beginning.\n setFocusEnd();\n }\n\n // Escape key only closes the menu, it doesn't open it.\n if (trigger == escape) {\n const expanded = e.target.getAttribute('aria-expanded');\n e.preventDefault();\n if (expanded == \"false\") {\n e.target.click();\n }\n }\n\n // Space key or Enter key opens the menu.\n if (trigger == space || trigger == enter) {\n // Cancel random scroll.\n e.preventDefault();\n // Open the menu instead.\n e.target.click();\n }\n }\n });\n\n // Special handling for navigation keys when menu is open.\n const shiftFocus = element => {\n const delayedFocus = pendingPromise => {\n element.focus();\n pendingPromise.resolve();\n };\n setTimeout(delayedFocus, 50, new Pending('core/aria:delayed-focus'));\n };\n\n $('.dropdown').on('shown.bs.dropdown', e => {\n // We need to focus on the first menuitem.\n const menu = e.target.querySelector('[role=\"menu\"]');\n let menuItems = false;\n let foundMenuItem = false;\n\n if (menu) {\n menuItems = menu.querySelectorAll('[role=\"menuitem\"]');\n }\n if (menuItems && menuItems.length > 0) {\n if (getFocusEnd()) {\n foundMenuItem = menuItems[menuItems.length - 1];\n } else {\n // The first menu entry, pretty reasonable.\n foundMenuItem = menuItems[0];\n }\n }\n if (foundMenuItem) {\n shiftFocus(foundMenuItem);\n }\n });\n // Search for menu items by finding the first item that has\n // text starting with the typed character (case insensitive).\n document.addEventListener('keypress', e => {\n if (e.target.matches('.dropdown [role=\"menu\"] [role=\"menuitem\"]')) {\n const trigger = String.fromCharCode(e.which).toLowerCase();\n const menu = e.target.closest('[role=\"menu\"]');\n\n if (!menu) {\n return;\n }\n const menuItems = menu.querySelectorAll('[role=\"menuitem\"]');\n if (!menuItems) {\n return;\n }\n\n for (let i = 0; i < menuItems.length; i++) {\n const item = menuItems[i];\n const itemText = item.text.trim().toLowerCase();\n if (itemText.indexOf(trigger) == 0) {\n shiftFocus(item);\n break;\n }\n }\n }\n });\n\n // Keyboard navigation for arrow keys, home and end keys.\n document.addEventListener('keydown', e => {\n if (e.target.matches('.dropdown [role=\"menu\"] [role=\"menuitem\"]')) {\n const trigger = e.which;\n let next = false;\n const menu = e.target.closest('[role=\"menu\"]');\n\n if (!menu) {\n return;\n }\n const menuItems = menu.querySelectorAll('[role=\"menuitem\"]');\n if (!menuItems) {\n return;\n }\n // Down key.\n if (trigger == arrowDown) {\n for (let i = 0; i < menuItems.length - 1; i++) {\n if (menuItems[i] == e.target) {\n next = menuItems[i + 1];\n break;\n }\n }\n if (!next) {\n // Wrap to first item.\n next = menuItems[0];\n }\n\n } else if (trigger == arrowUp) {\n // Up key.\n for (let i = 1; i < menuItems.length; i++) {\n if (menuItems[i] == e.target) {\n next = menuItems[i - 1];\n break;\n }\n }\n if (!next) {\n // Wrap to last item.\n next = menuItems[menuItems.length - 1];\n }\n\n } else if (trigger == home) {\n // Home key.\n next = menuItems[0];\n\n } else if (trigger == end) {\n // End key.\n next = menuItems[menuItems.length - 1];\n }\n // Variable next is set if we do want to act on the keypress.\n if (next) {\n e.preventDefault();\n shiftFocus(next);\n }\n return;\n }\n });\n\n $('.dropdown').on('hidden.bs.dropdown', e => {\n // We need to focus on the menu trigger.\n const trigger = e.target.querySelector('[data-toggle=\"dropdown\"]');\n if (trigger) {\n shiftFocus(trigger);\n }\n });\n};\n\n/**\n * After page load, focus on any element with special autofocus attribute.\n */\nconst autoFocus = () => {\n window.addEventListener(\"load\", () => {\n const alerts = document.querySelectorAll('[data-aria-autofocus=\"true\"][role=\"alert\"]');\n Array.prototype.forEach.call(alerts, autofocusElement => {\n // According to the specification an role=\"alert\" region is only read out on change to the content\n // of that region.\n autofocusElement.innerHTML += ' ';\n autofocusElement.removeAttribute('data-aria-autofocus');\n });\n });\n};\n\nexport const init = () => {\n dropdownFix();\n autoFocus();\n};\n"],"file":"aria.min.js"} \ No newline at end of file diff --git a/theme/boost/amd/build/loader.min.js b/theme/boost/amd/build/loader.min.js index baacba5c056..188f865c930 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",["exports","jquery","./aria","./bootstrap/index","core/pending","./scroll","./pending"],function(a,b,c,d,e,f,g){"use strict";Object.defineProperty(a,"__esModule",{value:!0});Object.defineProperty(a,"Bootstrap",{enumerable:!0,get:function get(){return d.default}});b=h(b);c=h(c);d=h(d);e=h(e);f=h(f);g=h(g);function h(a){return a&&a.__esModule?a:{default:a}}var i=function(){(0,b.default)("a[data-toggle=\"tab\"]").on("shown.bs.tab",function(a){var c=(0,b.default)(a.target).attr("href");if(history.replaceState){history.replaceState(null,null,c)}else{location.hash=c}});var a=window.location.hash;if(a){(0,b.default)(".nav-link[href=\""+a+"\"]").tab("show")}},j=function(){(0,b.default)("body").popover({container:"body",selector:"[data-toggle=\"popover\"]",trigger:"focus"});document.addEventListener("keydown",function(a){if("Escape"===a.key&&a.target.closest("[data-toggle=\"popover\"]")){(0,b.default)(a.target).popover("hide")}})},k=function(){(0,b.default)("body").tooltip({container:"body",selector:"[data-toggle=\"tooltip\"]"})},l=new e.default("theme_boost/loader:init");(0,g.default)();i();j();k();new f.default().init();b.default.fn.dropdown.Constructor.Default.flip=!1;c.default.init();l.resolve()}); +function _typeof(a){"@babel/helpers - typeof";if("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator){_typeof=function(a){return typeof a}}else{_typeof=function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a}}return _typeof(a)}define ("theme_boost/loader",["exports","jquery","./aria","./bootstrap/index","core/pending","./scroll","./pending"],function(a,b,c,d,e,f,g){"use strict";Object.defineProperty(a,"__esModule",{value:!0});Object.defineProperty(a,"Bootstrap",{enumerable:!0,get:function get(){return d.default}});b=j(b);c=i(c);d=j(d);e=j(e);f=j(f);g=j(g);function h(){if("function"!=typeof WeakMap)return null;var a=new WeakMap;h=function(){return a};return a}function i(a){if(a&&a.__esModule){return a}if(null===a||"object"!==_typeof(a)&&"function"!=typeof a){return{default:a}}var b=h();if(b&&b.has(a)){return b.get(a)}var c={},d=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var e in a){if(Object.prototype.hasOwnProperty.call(a,e)){var f=d?Object.getOwnPropertyDescriptor(a,e):null;if(f&&(f.get||f.set)){Object.defineProperty(c,e,f)}else{c[e]=a[e]}}}c.default=a;if(b){b.set(a,c)}return c}function j(a){return a&&a.__esModule?a:{default:a}}var k=function(){(0,b.default)("a[data-toggle=\"tab\"]").on("shown.bs.tab",function(a){var c=(0,b.default)(a.target).attr("href");if(history.replaceState){history.replaceState(null,null,c)}else{location.hash=c}});var a=window.location.hash;if(a){(0,b.default)(".nav-link[href=\""+a+"\"]").tab("show")}},l=function(){(0,b.default)("body").popover({container:"body",selector:"[data-toggle=\"popover\"]",trigger:"focus"});document.addEventListener("keydown",function(a){if("Escape"===a.key&&a.target.closest("[data-toggle=\"popover\"]")){(0,b.default)(a.target).popover("hide")}})},m=function(){(0,b.default)("body").tooltip({container:"body",selector:"[data-toggle=\"tooltip\"]"})},n=new e.default("theme_boost/loader:init");(0,g.default)();k();l();m();new f.default().init();b.default.fn.dropdown.Constructor.Default.flip=!1;c.init();n.resolve()}); //# 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 bcde39cc2fc..63d1fc7f7c7 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":["rememberTabs","on","e","hash","target","attr","history","replaceState","location","window","tab","enablePopovers","popover","container","selector","trigger","document","addEventListener","key","closest","enableTooltips","tooltip","pendingPromise","Pending","Scroll","init","$","fn","dropdown","Constructor","Default","flip","Aria","resolve"],"mappings":"qSA0BA,OACA,OACA,OACA,OACA,OACA,O,sDAKMA,CAAAA,CAAY,CAAG,UAAM,CACvB,cAAE,wBAAF,EAA0BC,EAA1B,CAA6B,cAA7B,CAA6C,SAASC,CAAT,CAAY,CACrD,GAAIC,CAAAA,CAAI,CAAG,cAAED,CAAC,CAACE,MAAJ,EAAYC,IAAZ,CAAiB,MAAjB,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,EAQA,GAAIA,CAAAA,CAAI,CAAGM,MAAM,CAACD,QAAP,CAAgBL,IAA3B,CACA,GAAIA,CAAJ,CAAU,CACP,cAAE,oBAAqBA,CAArB,CAA4B,KAA9B,EAAoCO,GAApC,CAAwC,MAAxC,CACF,CACJ,C,CAMKC,CAAc,CAAG,UAAM,CACzB,cAAE,MAAF,EAAUC,OAAV,CAAkB,CACdC,SAAS,CAAE,MADG,CAEdC,QAAQ,CAAE,2BAFI,CAGdC,OAAO,CAAE,OAHK,CAAlB,EAMAC,QAAQ,CAACC,gBAAT,CAA0B,SAA1B,CAAqC,SAAAf,CAAC,CAAI,CACtC,GAAc,QAAV,GAAAA,CAAC,CAACgB,GAAF,EAAsBhB,CAAC,CAACE,MAAF,CAASe,OAAT,CAAiB,2BAAjB,CAA1B,CAAuE,CACnE,cAAEjB,CAAC,CAACE,MAAJ,EAAYQ,OAAZ,CAAoB,MAApB,CACH,CACJ,CAJD,CAKH,C,CAMKQ,CAAc,CAAG,UAAM,CACzB,cAAE,MAAF,EAAUC,OAAV,CAAkB,CACdR,SAAS,CAAE,MADG,CAEdC,QAAQ,CAAE,2BAFI,CAAlB,CAIH,C,CAEKQ,CAAc,CAAG,GAAIC,UAAJ,CAAY,yBAAZ,C,CAGvB,gBAGAvB,CAAY,GAGZW,CAAc,GAGdS,CAAc,GAGb,GAAII,UAAJ,EAAD,CAAeC,IAAf,GAGAC,UAAEC,EAAF,CAAKC,QAAL,CAAcC,WAAd,CAA0BC,OAA1B,CAAkCC,IAAlC,IAGAC,UAAKP,IAAL,GAEAH,CAAc,CAACW,OAAf,E","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 */\n\nimport $ from 'jquery';\nimport Aria from './aria';\nimport Bootstrap from './bootstrap/index';\nimport Pending from 'core/pending';\nimport Scroll from './scroll';\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 var hash = window.location.hash;\n if (hash) {\n $('.nav-link[href=\"' + hash + '\"]').tab('show');\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// Remember the last visited tabs.\nrememberTabs();\n\n// Enable all popovers.\nenablePopovers();\n\n// Enable all tooltips.\nenableTooltips();\n\n// Add scroll handling.\n(new Scroll()).init();\n\n// Disables flipping the dropdowns up and getting hidden behind the navbar.\n$.fn.dropdown.Constructor.Default.flip = false;\n\n// Setup Aria helpers for Bootstrap features.\nAria.init();\n\npendingPromise.resolve();\n\nexport {\n Bootstrap,\n};\n"],"file":"loader.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/loader.js"],"names":["rememberTabs","on","e","hash","target","attr","history","replaceState","location","window","tab","enablePopovers","popover","container","selector","trigger","document","addEventListener","key","closest","enableTooltips","tooltip","pendingPromise","Pending","Scroll","init","$","fn","dropdown","Constructor","Default","flip","Aria","resolve"],"mappings":"wkBA0BA,OACA,OACA,OACA,OACA,OACA,O,4lBAKMA,CAAAA,CAAY,CAAG,UAAM,CACvB,cAAE,wBAAF,EAA0BC,EAA1B,CAA6B,cAA7B,CAA6C,SAASC,CAAT,CAAY,CACrD,GAAIC,CAAAA,CAAI,CAAG,cAAED,CAAC,CAAC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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 */\n\nimport $ from 'jquery';\nimport * as Aria from './aria';\nimport Bootstrap from './bootstrap/index';\nimport Pending from 'core/pending';\nimport Scroll from './scroll';\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 var hash = window.location.hash;\n if (hash) {\n $('.nav-link[href=\"' + hash + '\"]').tab('show');\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// Remember the last visited tabs.\nrememberTabs();\n\n// Enable all popovers.\nenablePopovers();\n\n// Enable all tooltips.\nenableTooltips();\n\n// Add scroll handling.\n(new Scroll()).init();\n\n// Disables flipping the dropdowns up and getting hidden behind the navbar.\n$.fn.dropdown.Constructor.Default.flip = false;\n\n// Setup Aria helpers for Bootstrap features.\nAria.init();\n\npendingPromise.resolve();\n\nexport {\n Bootstrap,\n};\n"],"file":"loader.min.js"} \ No newline at end of file diff --git a/theme/boost/amd/src/aria.js b/theme/boost/amd/src/aria.js index b2b96b0e143..812aad76680 100644 --- a/theme/boost/amd/src/aria.js +++ b/theme/boost/amd/src/aria.js @@ -20,181 +20,193 @@ * @copyright 2018 Damyon Wiese * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -define(['jquery', 'core/pending'], function($, Pending) { - return { - init: function() { - // Drop downs from bootstrap don't support keyboard accessibility by default. - var focusEnd = false, - setFocusEnd = function() { - focusEnd = true; - }, - getFocusEnd = function() { - var result = focusEnd; - focusEnd = false; - return result; - }; - // Special handling for "up" keyboard control. - $('[data-toggle="dropdown"]').keydown(function(e) { - var trigger = e.which || e.keyCode, - expanded; +import {end, escape, arrowUp, arrowDown, home, enter, space} from 'core/key_codes'; +import $ from 'jquery'; +import Pending from 'core/pending'; - // Up key opens the menu at the end. - if (trigger == 38) { - // Focus the end of the menu, not the beginning. - setFocusEnd(); +/** + * Drop downs from bootstrap don't support keyboard accessibility by default. + */ +const dropdownFix = () => { + let focusEnd = false; + const setFocusEnd = () => { + focusEnd = true; + }; + const getFocusEnd = () => { + const result = focusEnd; + focusEnd = false; + return result; + }; + + // Special handling for "up" keyboard control. + document.addEventListener('keydown', e => { + if (e.target.matches('[data-toggle="dropdown"]')) { + const trigger = e.which; + + // Up key opens the menu at the end. + if (trigger == arrowUp) { + // Focus the end of the menu, not the beginning. + setFocusEnd(); + } + + // Escape key only closes the menu, it doesn't open it. + if (trigger == escape) { + const expanded = e.target.getAttribute('aria-expanded'); + e.preventDefault(); + if (expanded == "false") { + e.target.click(); } + } - // Escape key only closes the menu, it doesn't open it. - if (trigger == 27) { - expanded = $(e.target).attr('aria-expanded'); - e.preventDefault(); - if (expanded == "false") { - $(e.target).click(); - } - } + // Space key or Enter key opens the menu. + if (trigger == space || trigger == enter) { + // Cancel random scroll. + e.preventDefault(); + // Open the menu instead. + e.target.click(); + } + } + }); - // Space key or Enter key opens the menu. - if (trigger == 32 || trigger == 13) { - // Cancel random scroll. - e.preventDefault(); - // Open the menu instead. - $(e.target).click(); - } - }); + // Special handling for navigation keys when menu is open. + const shiftFocus = element => { + const delayedFocus = pendingPromise => { + element.focus(); + pendingPromise.resolve(); + }; + setTimeout(delayedFocus, 50, new Pending('core/aria:delayed-focus')); + }; - // Special handling for navigation keys when menu is open. - var shiftFocus = function(element) { - var delayedFocus = function(pendingPromise) { - $(this).focus(); - pendingPromise.resolve(); - }.bind(element); - setTimeout(delayedFocus, 50, new Pending('core/aria:delayed-focus')); - }; + $('.dropdown').on('shown.bs.dropdown', e => { + // We need to focus on the first menuitem. + const menu = e.target.querySelector('[role="menu"]'); + let menuItems = false; + let foundMenuItem = false; - $('.dropdown').on('shown.bs.dropdown', function(e) { - // We need to focus on the first menuitem. - var menu = $(e.target).find('[role="menu"]'), - menuItems = false, - foundMenuItem = false; + if (menu) { + menuItems = menu.querySelectorAll('[role="menuitem"]'); + } + if (menuItems && menuItems.length > 0) { + if (getFocusEnd()) { + foundMenuItem = menuItems[menuItems.length - 1]; + } else { + // The first menu entry, pretty reasonable. + foundMenuItem = menuItems[0]; + } + } + if (foundMenuItem) { + shiftFocus(foundMenuItem); + } + }); + // Search for menu items by finding the first item that has + // text starting with the typed character (case insensitive). + document.addEventListener('keypress', e => { + if (e.target.matches('.dropdown [role="menu"] [role="menuitem"]')) { + const trigger = String.fromCharCode(e.which).toLowerCase(); + const menu = e.target.closest('[role="menu"]'); - if (menu) { - menuItems = $(menu).find('[role="menuitem"]'); - } - if (menuItems && menuItems.length > 0) { - if (getFocusEnd()) { - foundMenuItem = menuItems[menuItems.length - 1]; - } else { - // The first menu entry, pretty reasonable. - foundMenuItem = menuItems[0]; - } - } - if (foundMenuItem) { - shiftFocus(foundMenuItem); - } - }); - // Search for menu items by finding the first item that has - // text starting with the typed character (case insensitive). - $('.dropdown [role="menu"] [role="menuitem"]').keypress(function(e) { - var trigger = String.fromCharCode(e.which || e.keyCode), - menu = $(e.target).closest('[role="menu"]'), - i = 0, - menuItems = false, - item, - itemText; + if (!menu) { + return; + } + const menuItems = menu.querySelectorAll('[role="menuitem"]'); + if (!menuItems) { + return; + } - if (!menu) { - return; - } - menuItems = $(menu).find('[role="menuitem"]'); - if (!menuItems) { - return; + for (let i = 0; i < menuItems.length; i++) { + const item = menuItems[i]; + const itemText = item.text.trim().toLowerCase(); + if (itemText.indexOf(trigger) == 0) { + shiftFocus(item); + break; } + } + } + }); - trigger = trigger.toLowerCase(); - for (i = 0; i < menuItems.length; i++) { - item = $(menuItems[i]); - itemText = item.text().trim().toLowerCase(); - if (itemText.indexOf(trigger) == 0) { - shiftFocus(item); + // Keyboard navigation for arrow keys, home and end keys. + document.addEventListener('keydown', e => { + if (e.target.matches('.dropdown [role="menu"] [role="menuitem"]')) { + const trigger = e.which; + let next = false; + const menu = e.target.closest('[role="menu"]'); + + if (!menu) { + return; + } + const menuItems = menu.querySelectorAll('[role="menuitem"]'); + if (!menuItems) { + return; + } + // Down key. + if (trigger == arrowDown) { + for (let i = 0; i < menuItems.length - 1; i++) { + if (menuItems[i] == e.target) { + next = menuItems[i + 1]; break; } } - }); - - // Keyboard navigation for arrow keys, home and end keys. - $('.dropdown [role="menu"] [role="menuitem"]').keydown(function(e) { - var trigger = e.which || e.keyCode, - next = false, - menu = $(e.target).closest('[role="menu"]'), - i = 0, - menuItems = false; - if (!menu) { - return; - } - menuItems = $(menu).find('[role="menuitem"]'); - if (!menuItems) { - return; - } - // Down key. - if (trigger == 40) { - for (i = 0; i < menuItems.length - 1; i++) { - if (menuItems[i] == e.target) { - next = menuItems[i + 1]; - break; - } - } - if (!next) { - // Wrap to first item. - next = menuItems[0]; - } - - } else if (trigger == 38) { - // Up key. - for (i = 1; i < menuItems.length; i++) { - if (menuItems[i] == e.target) { - next = menuItems[i - 1]; - break; - } - } - if (!next) { - // Wrap to last item. - next = menuItems[menuItems.length - 1]; - } - - } else if (trigger == 36) { - // Home key. + if (!next) { + // Wrap to first item. next = menuItems[0]; + } - } else if (trigger == 35) { - // End key. + } else if (trigger == arrowUp) { + // Up key. + for (let i = 1; i < menuItems.length; i++) { + if (menuItems[i] == e.target) { + next = menuItems[i - 1]; + break; + } + } + if (!next) { + // Wrap to last item. next = menuItems[menuItems.length - 1]; } - // Variable next is set if we do want to act on the keypress. - if (next) { - e.preventDefault(); - shiftFocus(next); - } - return; - }); - $('.dropdown').on('hidden.bs.dropdown', function(e) { - // We need to focus on the menu trigger. - var trigger = $(e.target).find('[data-toggle="dropdown"]'); - if (trigger) { - shiftFocus(trigger); - } - }); - // After page load, focus on any element with special autofocus attribute. - window.addEventListener("load", () => { - const alerts = document.querySelectorAll('[data-aria-autofocus="true"][role="alert"]'); - Array.prototype.forEach.call(alerts, autofocusElement => { - // According to the specification an role="alert" region is only read out on change to the content - // of that region. - autofocusElement.innerHTML += ' '; - autofocusElement.removeAttribute('data-aria-autofocus'); - }); - }); + } else if (trigger == home) { + // Home key. + next = menuItems[0]; + + } else if (trigger == end) { + // End key. + next = menuItems[menuItems.length - 1]; + } + // Variable next is set if we do want to act on the keypress. + if (next) { + e.preventDefault(); + shiftFocus(next); + } + return; } - }; -}); + }); + + $('.dropdown').on('hidden.bs.dropdown', e => { + // We need to focus on the menu trigger. + const trigger = e.target.querySelector('[data-toggle="dropdown"]'); + if (trigger) { + shiftFocus(trigger); + } + }); +}; + +/** + * After page load, focus on any element with special autofocus attribute. + */ +const autoFocus = () => { + window.addEventListener("load", () => { + const alerts = document.querySelectorAll('[data-aria-autofocus="true"][role="alert"]'); + Array.prototype.forEach.call(alerts, autofocusElement => { + // According to the specification an role="alert" region is only read out on change to the content + // of that region. + autofocusElement.innerHTML += ' '; + autofocusElement.removeAttribute('data-aria-autofocus'); + }); + }); +}; + +export const init = () => { + dropdownFix(); + autoFocus(); +}; diff --git a/theme/boost/amd/src/loader.js b/theme/boost/amd/src/loader.js index a050c6f5187..c5b8ea582b7 100644 --- a/theme/boost/amd/src/loader.js +++ b/theme/boost/amd/src/loader.js @@ -25,7 +25,7 @@ */ import $ from 'jquery'; -import Aria from './aria'; +import * as Aria from './aria'; import Bootstrap from './bootstrap/index'; import Pending from 'core/pending'; import Scroll from './scroll';