mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-66247-master' of git://github.com/andrewnicols/moodle
This commit is contained in:
commit
be153c65d9
3 changed files with 10 additions and 12 deletions
2
theme/boost/amd/build/aria.min.js
vendored
2
theme/boost/amd/build/aria.min.js
vendored
|
@ -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<d.length){if(e()){g=d[d.length-1]}else{g=d[0]}}if(g){f(g)}});a(".dropdown [role=\"menu\"] [role=\"menuitem\"]").keypress(function(b){var c=String.fromCharCode(b.which||b.keyCode),d=a(b.target).closest("[role=\"menu\"]"),e=0,g=!1,h,j;if(!d){return}g=a(d).find("[role=\"menuitem\"]");if(!g){return}c=c.toLowerCase();for(e=0;e<g.length;e++){h=a(g[e]);j=h.text().trim().toLowerCase();if(0==j.indexOf(c)){f(h);break}}});a(".dropdown [role=\"menu\"] [role=\"menuitem\"]").keydown(function(b){var c=b.which||b.keyCode,d=!1,e=a(b.target).closest("[role=\"menu\"]"),g=0,h=!1;if(!e){return}h=a(e).find("[role=\"menuitem\"]");if(!h){return}if(40==c){for(g=0;g<h.length-1;g++){if(h[g]==b.target){d=h[g+1];break}}if(!d){d=h[0]}}else if(38==c){for(g=1;g<h.length;g++){if(h[g]==b.target){d=h[g-1];break}}if(!d){d=h[h.length-1]}}else if(36==c){d=h[0]}else if(35==c){d=h[h.length-1]}if(d){b.preventDefault();f(d)}});a(".dropdown").on("hidden.bs.dropdown",function(b){var c=a(b.target).find("[data-toggle=\"dropdown\"]");if(c){f(c)}});var g=new b("core/aria:delayed-focus");a(function(){window.setTimeout(function(b){var c=a("[role=\"alert\"][data-aria-autofocus=\"true\"]");if(0<c.length){a(c[0]).attr("tabindex","0");a(c[0]).focus()}b.resolve()},300,g)})}}});
|
||||
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<d.length){if(e()){g=d[d.length-1]}else{g=d[0]}}if(g){f(g)}});a(".dropdown [role=\"menu\"] [role=\"menuitem\"]").keypress(function(b){var c=String.fromCharCode(b.which||b.keyCode),d=a(b.target).closest("[role=\"menu\"]"),e=0,g=!1,h,j;if(!d){return}g=a(d).find("[role=\"menuitem\"]");if(!g){return}c=c.toLowerCase();for(e=0;e<g.length;e++){h=a(g[e]);j=h.text().trim().toLowerCase();if(0==j.indexOf(c)){f(h);break}}});a(".dropdown [role=\"menu\"] [role=\"menuitem\"]").keydown(function(b){var c=b.which||b.keyCode,d=!1,e=a(b.target).closest("[role=\"menu\"]"),g=0,h=!1;if(!e){return}h=a(e).find("[role=\"menuitem\"]");if(!h){return}if(40==c){for(g=0;g<h.length-1;g++){if(h[g]==b.target){d=h[g+1];break}}if(!d){d=h[0]}}else if(38==c){for(g=1;g<h.length;g++){if(h[g]==b.target){d=h[g-1];break}}if(!d){d=h[h.length-1]}}else if(36==c){d=h[0]}else if(35==c){d=h[h.length-1]}if(d){b.preventDefault();f(d)}});a(".dropdown").on("hidden.bs.dropdown",function(b){var c=a(b.target).find("[data-toggle=\"dropdown\"]");if(c){f(c)}});window.addEventListener("load",function(){var a=document.querySelectorAll("[data-aria-autofocus=\"true\"][role=\"alert\"]");Array.prototype.forEach.call(a,function(a){a.innerHTML+=" ";a.removeAttribute("data-aria-autofocus")})})}}});
|
||||
//# sourceMappingURL=aria.min.js.map
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -186,16 +186,14 @@ define(['jquery', 'core/pending'], function($, Pending) {
|
|||
});
|
||||
|
||||
// After page load, focus on any element with special autofocus attribute.
|
||||
var delayedFocusPromise = new Pending('core/aria:delayed-focus');
|
||||
$(function() {
|
||||
window.setTimeout(function(pendingPromise) {
|
||||
var alerts = $('[role="alert"][data-aria-autofocus="true"]');
|
||||
if (alerts.length > 0) {
|
||||
$(alerts[0]).attr('tabindex', '0');
|
||||
$(alerts[0]).focus();
|
||||
}
|
||||
pendingPromise.resolve();
|
||||
}, 300, delayedFocusPromise);
|
||||
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');
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue