Merge branch 'MDL-66247-36' of git://github.com/andrewnicols/moodle into MOODLE_36_STABLE
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
Example context (json):
|
||||
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
|
||||
}}
|
||||
<div class="alert alert-error alert-block fade in {{ extraclasses }}" {{!
|
||||
<div class="alert alert-error alert-block fade in {{ extraclasses }}" id="notification-{{uniqid}}"{{!
|
||||
}}{{# announce }} role="alert"{{/ announce }}{{!
|
||||
}}>
|
||||
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">×</button>{{/ closebutton }}
|
||||
@@ -47,4 +47,12 @@ require(['jquery', 'theme_bootstrapbase/bootstrap'], function($) {
|
||||
// Setup closing of bootstrap alerts.
|
||||
$().alert();
|
||||
});
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
// This is a hack to ensure that the role="alert" is read out.
|
||||
var alert = document.querySelector('#notification-{{uniqid}}[role="alert"]');
|
||||
if (alert) {
|
||||
alert.innerHTML += ' ';
|
||||
}
|
||||
});
|
||||
{{/ js }}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
Example context (json):
|
||||
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
|
||||
}}
|
||||
<div class="alert alert-info alert-block fade in {{ extraclasses }}" {{!
|
||||
<div class="alert alert-info alert-block fade in {{ extraclasses }}" id="notification-{{uniqid}}"{{!
|
||||
}}{{# announce }} role="alert"{{/ announce }}{{!
|
||||
}}>
|
||||
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">×</button>{{/ closebutton }}
|
||||
@@ -47,4 +47,12 @@ require(['jquery', 'theme_bootstrapbase/bootstrap'], function($) {
|
||||
// Setup closing of bootstrap alerts.
|
||||
$().alert();
|
||||
});
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
// This is a hack to ensure that the role="alert" is read out.
|
||||
var alert = document.querySelector('#notification-{{uniqid}}[role="alert"]');
|
||||
if (alert) {
|
||||
alert.innerHTML += ' ';
|
||||
}
|
||||
});
|
||||
{{/ js }}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
Example context (json):
|
||||
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
|
||||
}}
|
||||
<div class="alert alert-success alert-block fade in {{ extraclasses }}" {{!
|
||||
<div class="alert alert-success alert-block fade in {{ extraclasses }}" id="notification-{{uniqid}}"{{!
|
||||
}}{{# announce }} role="alert"{{/ announce }}{{!
|
||||
}}>
|
||||
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">×</button>{{/ closebutton }}
|
||||
@@ -47,4 +47,12 @@ require(['jquery', 'theme_bootstrapbase/bootstrap'], function($) {
|
||||
// Setup closing of bootstrap alerts.
|
||||
$().alert();
|
||||
});
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
// This is a hack to ensure that the role="alert" is read out.
|
||||
var alert = document.querySelector('#notification-{{uniqid}}[role="alert"]');
|
||||
if (alert) {
|
||||
alert.innerHTML += ' ';
|
||||
}
|
||||
});
|
||||
{{/ js }}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
Example context (json):
|
||||
{ "message": "Your pants are on fire!", "closebutton": 1, "announce": 1, "extraclasses": "foo bar"}
|
||||
}}
|
||||
<div class="alert alert-warning alert-block fade in {{ extraclasses }}" {{!
|
||||
<div class="alert alert-warning alert-block fade in {{ extraclasses }}" id="notification-{{uniqid}}"{{!
|
||||
}}{{# announce }} role="alert"{{/ announce }}{{!
|
||||
}}>
|
||||
{{# closebutton }}<button type="button" class="close" data-dismiss="alert">×</button>{{/ closebutton }}
|
||||
@@ -47,4 +47,12 @@ require(['jquery', 'theme_bootstrapbase/bootstrap'], function($) {
|
||||
// Setup closing of bootstrap alerts.
|
||||
$().alert();
|
||||
});
|
||||
|
||||
window.addEventListener('load', function() {
|
||||
// This is a hack to ensure that the role="alert" is read out.
|
||||
var alert = document.querySelector('#notification-{{uniqid}}[role="alert"]');
|
||||
if (alert) {
|
||||
alert.innerHTML += ' ';
|
||||
}
|
||||
});
|
||||
{{/ js }}
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
define(["jquery","core/pending"],function(a,b){return{init:function(){var c=!1,d=function(){c=!0},e=function(){var a=c;return c=!1,a};a('[data-toggle="dropdown"]').keydown(function(b){var c,e=b.which||b.keyCode;38==e&&d(),27==e&&(c=a(b.target).attr("aria-expanded"),b.preventDefault(),"false"==c&&a(b.target).click()),32!=e&&13!=e||(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;c&&(d=a(c).find('[role="menuitem"]')),d&&d.length>0&&(g=e()?d[d.length-1]:d[0]),g&&f(g)}),a('.dropdown [role="menu"] [role="menuitem"]').keypress(function(b){var c,d,e=String.fromCharCode(b.which||b.keyCode),g=a(b.target).closest('[role="menu"]'),h=0,i=!1;if(g&&(i=a(g).find('[role="menuitem"]')))for(e=e.toLowerCase(),h=0;h<i.length;h++)if(c=a(i[h]),d=c.text().trim().toLowerCase(),0==d.indexOf(e)){f(c);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&&(h=a(e).find('[role="menuitem"]'))){if(40==c){for(g=0;g<h.length-1;g++)if(h[g]==b.target){d=h[g+1];break}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}d||(d=h[h.length-1])}else 36==c?d=h[0]:35==c&&(d=h[h.length-1]);d&&(b.preventDefault(),f(d))}}),a(".dropdown").on("hidden.bs.dropdown",function(b){var c=a(b.target).find('[data-toggle="dropdown"]');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"]');c.length>0&&(a(c[0]).attr("tabindex","0"),a(c[0]).focus()),b.resolve()},300,g)})}}});
|
||||
define(["jquery","core/pending"],function(a,b){return{init:function(){var c=!1,d=function(){c=!0},e=function(){var a=c;return c=!1,a};a('[data-toggle="dropdown"]').keydown(function(b){var c,e=b.which||b.keyCode;38==e&&d(),27==e&&(c=a(b.target).attr("aria-expanded"),b.preventDefault(),"false"==c&&a(b.target).click()),32!=e&&13!=e||(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;c&&(d=a(c).find('[role="menuitem"]')),d&&d.length>0&&(g=e()?d[d.length-1]:d[0]),g&&f(g)}),a('.dropdown [role="menu"] [role="menuitem"]').keypress(function(b){var c,d,e=String.fromCharCode(b.which||b.keyCode),g=a(b.target).closest('[role="menu"]'),h=0,i=!1;if(g&&(i=a(g).find('[role="menuitem"]')))for(e=e.toLowerCase(),h=0;h<i.length;h++)if(c=a(i[h]),d=c.text().trim().toLowerCase(),0==d.indexOf(e)){f(c);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&&(h=a(e).find('[role="menuitem"]'))){if(40==c){for(g=0;g<h.length-1;g++)if(h[g]==b.target){d=h[g+1];break}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}d||(d=h[h.length-1])}else 36==c?d=h[0]:35==c&&(d=h[h.length-1]);d&&(b.preventDefault(),f(d))}}),a(".dropdown").on("hidden.bs.dropdown",function(b){var c=a(b.target).find('[data-toggle="dropdown"]');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")})})}}});
|
||||
@@ -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", function() {
|
||||
var alerts = document.querySelectorAll('[data-aria-autofocus="true"][role="alert"]');
|
||||
Array.prototype.forEach.call(alerts, function(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');
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user