Commit e7f029f6 by Adam Palay

a11y: manage focus appropriately for modals with iframes in IE (LMS-1539)

parent 2852a4f9
...@@ -95,7 +95,7 @@ var accessible_modal = function(trigger, closeButtonId, modalId, mainPageId) { ...@@ -95,7 +95,7 @@ var accessible_modal = function(trigger, closeButtonId, modalId, mainPageId) {
$("#lean_overlay, " + closeButtonId).click(function(){ $("#lean_overlay, " + closeButtonId).click(function(){
$(mainPageId).attr("aria-hidden", "false"); $(mainPageId).attr("aria-hidden", "false");
$(modalId).attr("aria-hidden", "true"); $(modalId).attr("aria-hidden", "true");
focusedElementBeforeModal.focus() focusedElementBeforeModal.focus();
}); });
// get modal to exit on escape key // get modal to exit on escape key
...@@ -107,6 +107,18 @@ var accessible_modal = function(trigger, closeButtonId, modalId, mainPageId) { ...@@ -107,6 +107,18 @@ var accessible_modal = function(trigger, closeButtonId, modalId, mainPageId) {
$(closeButtonId).click(); $(closeButtonId).click();
} }
}); });
// In IE, focus shifts to iframes when they load.
// These lines ensure that focus is shifted back to the close button
// in the case that a modal that contains an iframe is opened in IE.
// see http://stackoverflow.com/questions/15792620/how-to-get-focus-back-for-parent-window-from-an-iframe-programmatically-in-javas
var initialFocus = true
$(modalId).find("iframe").on("focus", function() {
if (initialFocus) {
$(closeButtonId).focus();
initialFocus = false;
};
});
}); });
}; };
......
Markdown is supported
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