diff --git a/CHANGES.md b/CHANGES.md index 2e2d47087b185acad89ab9acc4a70f77ff88e603..c4180886d9fff397876b32c1be2f6c3d23a0a423 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2020-03-10 - Fixed accessibility issues with in-course settings. * 2020-03-09 - Fixed accessibility issues with back-to-top button. * 2020-03-05 - Adjusted function full_header() in core_renderer.php due to upstream changes in theme Boost. * 2020-03-05 - Removed SCSS rule to wrap words in cards as it has been fixed in theme Boost. diff --git a/amd/build/incoursesettings.min.js b/amd/build/incoursesettings.min.js index 529f4fee3dfa7e5d20311477ab093810a43f5c7b..6fac6e543c3745bf5dc02eb615ab3935c8ee6004 100644 --- a/amd/build/incoursesettings.min.js +++ b/amd/build/incoursesettings.min.js @@ -1,2 +1,2 @@ -define ("theme_boost_campus/incoursesettings",["jquery"],function(a){"use strict";function b(){var b=a("#boost-campus-course-settings"),c=a("#boost-campus-activity-settings"),d=a("body").hasClass("pagelayout-frontpage"),e=a("#page-header .card").css("border-bottom");if(!d){a("#page-header .context-header-settings-menu").on("click",function(d){d.stopPropagation();if(b.is(":visible")){b.hide(400);setTimeout(function(){a("#page-header .card").css("border-bottom",e);a("#page-header > div").addClass("pb-3")},300)}else{b.show(400);a("#page-header div").removeClass("pb-3");a("#page-header .card").css("border-bottom","none");b.css("border-top","none");if(c.is(":visible")){c.hide(400)}}});a("#region-main-settings-menu .action-menu .dropdown-toggle").on("click",function(d){d.stopPropagation();if(c.is(":visible")){c.hide(400)}else{c.show(400);setTimeout(function(){a("#page-header .card").css("border-bottom",e);a("#page-header > div").addClass("pb-3")},300);if(b.is(":visible")){b.hide(400)}}})}}return{init:function init(){b()}}}); +define ("theme_boost_campus/incoursesettings",["jquery"],function(a){"use strict";function b(){var b=a("body").hasClass("pagelayout-frontpage");if(!b){var c=a("#boost-campus-course-settings"),d=a("#boost-campus-activity-settings"),e=a("#page-header .card").css("border-bottom"),f=a("#page-header .context-header-settings-menu .dropdown-toggle"),g=a("#region-main-settings-menu .action-menu .dropdown-toggle");f.removeAttr("aria-haspopup").attr("aria-controls","boost-campus-course-settings");g.removeAttr("aria-haspopup").attr("aria-controls","boost-campus-activity-settings");f.on("click",function(b){b.stopPropagation();if(c.is(":visible")){c.hide(400);f.attr("aria-expanded","false");setTimeout(function(){a("#page-header .card").css("border-bottom",e);a("#page-header > div").addClass("pb-3")},300)}else{c.show(400);a("#page-header div").removeClass("pb-3");a("#page-header .card").css("border-bottom","none");c.css("border-top","none");f.attr("aria-expanded","true");if(d.is(":visible")){d.hide(400);g.attr("aria-expanded","false")}}});g.on("click",function(b){b.stopPropagation();if(d.is(":visible")){d.hide(400);g.attr("aria-expanded","false")}else{d.show(400);g.attr("aria-expanded","true");setTimeout(function(){a("#page-header .card").css("border-bottom",e);a("#page-header > div").addClass("pb-3")},300);if(c.is(":visible")){c.hide(400);f.attr("aria-expanded","false")}}})}}return{init:function init(){b()}}}); //# sourceMappingURL=incoursesettings.min.js.map diff --git a/amd/build/incoursesettings.min.js.map b/amd/build/incoursesettings.min.js.map index c7444ca690f420ddc6240317efa50d722f7bb862..08fc77d5352a331f55166a29c00ce82634efbe79 100644 --- a/amd/build/incoursesettings.min.js.map +++ b/amd/build/incoursesettings.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/incoursesettings.js"],"names":["define","$","initInCourseSettings","courseSettings","activitySettings","frontpage","hasClass","headerCardBorderBottom","css","on","event","stopPropagation","is","hide","setTimeout","addClass","show","removeClass","init"],"mappings":"AAuBAA,OAAM,uCAAC,CAAC,QAAD,CAAD,CAAa,SAASC,CAAT,CAAY,CAC3B,aAKA,QAASC,CAAAA,CAAT,EAAgC,IACxBC,CAAAA,CAAc,CAAGF,CAAC,CAAC,+BAAD,CADM,CAExBG,CAAgB,CAAGH,CAAC,CAAC,iCAAD,CAFI,CAGxBI,CAAS,CAAGJ,CAAC,CAAC,MAAD,CAAD,CAAUK,QAAV,CAAmB,sBAAnB,CAHY,CAIxB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O,GAAxB,CAA4B,eAA5B,CAA6CD,CAA7C,EACAN,CAAC,CAAC,oBAAD,CAAD,CAAwBc,QAAxB,CAAiC,MAAjC,CACH,CAHS,CAGP,GAHO,CAAV,CAKA,GAAIZ,CAAc,CAACS,EAAf,CAAkB,UAAlB,CAAJ,CAAmC,CAC/BT,CAAc,CAACU,IAAf,CAAoB,GAApB,CACH,CACJ,CACJ,CAfD,CAgBH,CACJ,CAED,MAAO,CACHK,IAAI,CAAE,eAAW,CACbhB,CAAoB,EACvB,CAHE,CAKV,CA1DK,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 <http://www.gnu.org/licenses/>.\n\n/**\n * Theme Boost Campus - JS code for displaying course setting within the course.\n *\n * @package theme_boost_campus\n * @copyright 2017 Kathrin Osswald, Ulm University <kathrin.osswald@uni-ulm.de>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery'], function($) {\n \"use strict\";\n\n /**\n * Initialising.\n */\n function initInCourseSettings() {\n var courseSettings = $('#boost-campus-course-settings');\n var activitySettings = $('#boost-campus-activity-settings');\n var frontpage = $('body').hasClass('pagelayout-frontpage');\n var headerCardBorderBottom = $('#page-header .card').css(\"border-bottom\");\n\n // Only change the behaviour if the setting is enabled and we are not on the frontpage,\n // because we did not change the settings menu there. So we need the default propagation here.\n if (!frontpage) {\n $('#page-header .context-header-settings-menu').on('click', function(event) {\n event.stopPropagation();\n if (courseSettings.is(\":visible\")) {\n courseSettings.hide(400);\n setTimeout(function() {\n $('#page-header .card').css('border-bottom', headerCardBorderBottom);\n $('#page-header > div').addClass('pb-3');\n }, 300);\n } else {\n courseSettings.show(400);\n $('#page-header div').removeClass('pb-3');\n $('#page-header .card').css('border-bottom', 'none');\n courseSettings.css('border-top', 'none');\n // Additionally close activity settings if they are currently open.\n if (activitySettings.is(\":visible\")) {\n activitySettings.hide(400);\n }\n }\n });\n $('#region-main-settings-menu .action-menu .dropdown-toggle').on('click', function(event) {\n event.stopPropagation();\n if (activitySettings.is(\":visible\")) {\n activitySettings.hide(400);\n } else {\n activitySettings.show(400);\n setTimeout(function() {\n $('#page-header .card').css('border-bottom', headerCardBorderBottom);\n $('#page-header > div').addClass('pb-3');\n }, 300);\n // Additionally close course settings if they are currently open.\n if (courseSettings.is(\":visible\")) {\n courseSettings.hide(400);\n }\n }\n });\n }\n }\n\n return {\n init: function() {\n initInCourseSettings();\n }\n };\n});\n"],"file":"incoursesettings.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/incoursesettings.js"],"names":["define","$","initInCourseSettings","frontpage","hasClass","courseSettings","activitySettings","headerCardBorderBottom","css","courseSettingsDropdownToggle","activitySettingsDropdownToggle","removeAttr","attr","on","event","stopPropagation","is","hide","setTimeout","addClass","show","removeClass","init"],"mappings":"AAuBAA,OAAM,uCAAC,CAAC,QAAD,CAAD,CAAa,SAASC,CAAT,CAAY,CAC3B,aAKA,QAASC,CAAAA,CAAT,EAAgC,CAC5B,GAAIC,CAAAA,CAAS,CAAGF,CAAC,CAAC,MAAD,CAAD,CAAUG,QAAV,CAAmB,sBAAnB,CAAhB,CAIA,GAAI,CAACD,CAAL,CAAgB,IAERE,CAAAA,CAAc,CAAGJ,CAAC,CAAC,+BAAD,CAFV,CAGRK,CAAgB,CAAGL,CAAC,CAAC,iCAAD,CAHZ,CAIRM,CAAsB,CAAGN,CAAC,CAAC,oBAAD,CAAD,CAAwBO,GAAxB,CAA4B,eAA5B,CAJjB,CAKRC,CAA4B,CAAGR,CAAC,CAAC,6DAAD,CALxB,CAMRS,CAA8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GAAIT,CAAgB,CAACU,EAAjB,CAAoB,UAApB,CAAJ,CAAqC,CACjCV,CAAgB,CAACW,IAAjB,CAAsB,GAAtB,EACAP,CAA8B,CAACE,IAA/B,CAAoC,eAApC,CAAqD,OAArD,CACH,CAHD,IAGO,CACHN,CAAgB,CAACc,IAAjB,CAAsB,GAAtB,EACAV,CAA8B,CAACE,IAA/B,CAAoC,eAApC,CAAqD,MAArD,EACAM,UAAU,CAAC,UAAW,CAClBjB,CAAC,CAAC,oBAAD,CAAD,CAAwBO,GAAxB,CAA4B,eAA5B,CAA6CD,CAA7C,EACAN,CAAC,CAAC,oBAAD,CAAD,CAAwBkB,QAAxB,CAAiC,MAAjC,CACH,CAHS,CAGP,GAHO,CAAV,CAKA,GAAId,CAAc,CAACW,EAAf,CAAkB,UAAlB,CAAJ,CAAmC,CAC/BX,CAAc,CAACY,IAAf,CAAoB,GAApB,EACAR,CAA4B,CAACG,IAA7B,CAAkC,eAAlC,CAAmD,OAAnD,CACH,CACJ,CACJ,CAlBD,CAmBH,CACJ,CAED,MAAO,CACHU,IAAI,CAAE,eAAW,CACbpB,CAAoB,EACvB,CAHE,CAKV,CA5EK,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 <http://www.gnu.org/licenses/>.\n\n/**\n * Theme Boost Campus - JS code for displaying course setting within the course.\n *\n * @package theme_boost_campus\n * @copyright 2017 Kathrin Osswald, Ulm University <kathrin.osswald@uni-ulm.de>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery'], function($) {\n \"use strict\";\n\n /**\n * Initialising.\n */\n function initInCourseSettings() {\n var frontpage = $('body').hasClass('pagelayout-frontpage');\n\n // Only change the behaviour if the setting is enabled and we are not on the frontpage,\n // because we did not change the settings menu there. So we need the default propagation here.\n if (!frontpage) {\n\n var courseSettings = $('#boost-campus-course-settings');\n var activitySettings = $('#boost-campus-activity-settings');\n var headerCardBorderBottom = $('#page-header .card').css(\"border-bottom\");\n var courseSettingsDropdownToggle = $('#page-header .context-header-settings-menu .dropdown-toggle');\n var activitySettingsDropdownToggle = $('#region-main-settings-menu .action-menu .dropdown-toggle');\n\n // Remove attribute aria-haspopup because we are replacing this with the in-course course settings and\n // set the new in-course course settings for the aria-controls attribute\n courseSettingsDropdownToggle.removeAttr('aria-haspopup').attr('aria-controls', 'boost-campus-course-settings');\n\n // Remove attribute aria-haspopup because we are replacing this with the in-course activity settings\n // set the new in-course activity settings for the aria-controls attribute\n activitySettingsDropdownToggle.removeAttr('aria-haspopup').attr('aria-controls', 'boost-campus-activity-settings');\n\n courseSettingsDropdownToggle.on('click', function(event) {\n event.stopPropagation();\n if (courseSettings.is(\":visible\")) {\n courseSettings.hide(400);\n courseSettingsDropdownToggle.attr('aria-expanded', 'false');\n setTimeout(function() {\n $('#page-header .card').css('border-bottom', headerCardBorderBottom);\n $('#page-header > div').addClass('pb-3');\n }, 300);\n } else {\n courseSettings.show(400);\n $('#page-header div').removeClass('pb-3');\n $('#page-header .card').css('border-bottom', 'none');\n courseSettings.css('border-top', 'none');\n courseSettingsDropdownToggle.attr('aria-expanded', 'true');\n // Additionally close activity settings if they are currently open.\n if (activitySettings.is(\":visible\")) {\n activitySettings.hide(400);\n activitySettingsDropdownToggle.attr('aria-expanded', 'false');\n }\n }\n });\n activitySettingsDropdownToggle.on('click', function(event) {\n event.stopPropagation();\n if (activitySettings.is(\":visible\")) {\n activitySettings.hide(400);\n activitySettingsDropdownToggle.attr('aria-expanded', 'false');\n } else {\n activitySettings.show(400);\n activitySettingsDropdownToggle.attr('aria-expanded', 'true');\n setTimeout(function() {\n $('#page-header .card').css('border-bottom', headerCardBorderBottom);\n $('#page-header > div').addClass('pb-3');\n }, 300);\n // Additionally close course settings if they are currently open.\n if (courseSettings.is(\":visible\")) {\n courseSettings.hide(400);\n courseSettingsDropdownToggle.attr('aria-expanded', 'false');\n }\n }\n });\n }\n }\n\n return {\n init: function() {\n initInCourseSettings();\n }\n };\n});\n"],"file":"incoursesettings.min.js"} \ No newline at end of file diff --git a/amd/src/incoursesettings.js b/amd/src/incoursesettings.js index b3d4987436889ec0daaaa979cad1f6e7a07e03fc..29a7ecc4c70bc2e38ef16394b6cc5b63ccb52460 100644 --- a/amd/src/incoursesettings.js +++ b/amd/src/incoursesettings.js @@ -28,18 +28,31 @@ define(['jquery'], function($) { * Initialising. */ function initInCourseSettings() { - var courseSettings = $('#boost-campus-course-settings'); - var activitySettings = $('#boost-campus-activity-settings'); var frontpage = $('body').hasClass('pagelayout-frontpage'); - var headerCardBorderBottom = $('#page-header .card').css("border-bottom"); // Only change the behaviour if the setting is enabled and we are not on the frontpage, // because we did not change the settings menu there. So we need the default propagation here. if (!frontpage) { - $('#page-header .context-header-settings-menu').on('click', function(event) { + + var courseSettings = $('#boost-campus-course-settings'); + var activitySettings = $('#boost-campus-activity-settings'); + var headerCardBorderBottom = $('#page-header .card').css("border-bottom"); + var courseSettingsDropdownToggle = $('#page-header .context-header-settings-menu .dropdown-toggle'); + var activitySettingsDropdownToggle = $('#region-main-settings-menu .action-menu .dropdown-toggle'); + + // Remove attribute aria-haspopup because we are replacing this with the in-course course settings and + // set the new in-course course settings for the aria-controls attribute + courseSettingsDropdownToggle.removeAttr('aria-haspopup').attr('aria-controls', 'boost-campus-course-settings'); + + // Remove attribute aria-haspopup because we are replacing this with the in-course activity settings + // set the new in-course activity settings for the aria-controls attribute + activitySettingsDropdownToggle.removeAttr('aria-haspopup').attr('aria-controls', 'boost-campus-activity-settings'); + + courseSettingsDropdownToggle.on('click', function(event) { event.stopPropagation(); if (courseSettings.is(":visible")) { courseSettings.hide(400); + courseSettingsDropdownToggle.attr('aria-expanded', 'false'); setTimeout(function() { $('#page-header .card').css('border-bottom', headerCardBorderBottom); $('#page-header > div').addClass('pb-3'); @@ -49,18 +62,22 @@ define(['jquery'], function($) { $('#page-header div').removeClass('pb-3'); $('#page-header .card').css('border-bottom', 'none'); courseSettings.css('border-top', 'none'); + courseSettingsDropdownToggle.attr('aria-expanded', 'true'); // Additionally close activity settings if they are currently open. if (activitySettings.is(":visible")) { activitySettings.hide(400); + activitySettingsDropdownToggle.attr('aria-expanded', 'false'); } } }); - $('#region-main-settings-menu .action-menu .dropdown-toggle').on('click', function(event) { + activitySettingsDropdownToggle.on('click', function(event) { event.stopPropagation(); if (activitySettings.is(":visible")) { activitySettings.hide(400); + activitySettingsDropdownToggle.attr('aria-expanded', 'false'); } else { activitySettings.show(400); + activitySettingsDropdownToggle.attr('aria-expanded', 'true'); setTimeout(function() { $('#page-header .card').css('border-bottom', headerCardBorderBottom); $('#page-header > div').addClass('pb-3'); @@ -68,6 +85,7 @@ define(['jquery'], function($) { // Additionally close course settings if they are currently open. if (courseSettings.is(":visible")) { courseSettings.hide(400); + courseSettingsDropdownToggle.attr('aria-expanded', 'false'); } } });