Commit f0bfedf3 authored by Andrew Nicols's avatar Andrew Nicols
Browse files

MDL-63714 theme_boost: Fix aria focus behat issues

parent 4b7ad884
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -65,8 +65,10 @@ define(['jquery'], function($) {
// Special handling for navigation keys when menu is open.
var shiftFocus = function(element) {
M.util.pending_js('core/aria:delayed-focus');
var delayedFocus = function() {
$(this).focus();
M.util.complete_js('core/aria:delayed-focus');
}.bind(element);
setTimeout(delayedFocus, 50);
};
......@@ -186,12 +188,14 @@ define(['jquery'], function($) {
// After page load, focus on any element with special autofocus attribute.
$(function() {
M.util.pending_js('core/aria:delayed-focus');
window.setTimeout(function() {
var alerts = $('[role="alert"][data-aria-autofocus="true"]');
if (alerts.length > 0) {
$(alerts[0]).attr('tabindex', '0');
$(alerts[0]).focus();
}
M.util.complete_js('core/aria:delayed-focus');
}, 300);
});
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment