Commit 9affd38d by Adam Palay

fix focus management for help modal

parent 1fe982fb
......@@ -80,8 +80,8 @@ discussion_link = get_discussion_link(course) if course else None
</form>
</div>
<div class="inner-wrapper" id="feedback_success_wrapper" tabindex="-1">
<a href="#" role="button" class="close-modal" title="${_('Close Modal')}">&#10005;</a>
<div class="inner-wrapper" id="feedback_success_wrapper" tabindex="0">
<a href="#" role="button" class="close-modal" title="${_('Close Modal')}" tabindex="0">&#10005;</a>
<header>
<h2>${_('Thank You!')}</h2>
......@@ -106,7 +106,7 @@ discussion_link = get_discussion_link(course) if course else None
).format(
open_time=open_time,
close_time=close_time,
link_start='<a href="{}" target="_blank" id="feedback-faq-link">'.format(marketing_link('FAQ')),
link_start='<a href="{}" target="_blank" id="feedback-faq-link" tabindex="0">'.format(marketing_link('FAQ')),
link_end='</a>'
)}
</p>
......@@ -119,7 +119,8 @@ discussion_link = get_discussion_link(course) if course else None
$(".help-modal .close-modal").off("click");
$("#lean_overlay").off("click");
$("#help-modal").attr("aria-hidden", "true");
$(".help-tab").focus();
$('area,input,select,textarea,button').removeAttr('tabindex');
$(".help-tab a").focus();
},
cycle_modal_tab = function(from_element_name, to_element_name) {
$(from_element_name).on('keydown', function(e) {
......@@ -156,7 +157,7 @@ discussion_link = get_discussion_link(course) if course else None
};
cycle_modal_tab("#feedback_link_question", "#help_wrapper .close-modal");
cycle_modal_tab("#feedback_submit", "#feedback_form_wrapper .close-modal");
cycle_modal_tab("#feedback_faq_link", "#feedback_success_wrapper .close-modal");
cycle_modal_tab("#feedback-faq-link", "#feedback_success_wrapper .close-modal");
$("#help-modal").on("keydown", function(e) {
var keyCode = e.keyCode || e.which;
if (keyCode === 27) {
......@@ -194,6 +195,8 @@ discussion_link = get_discussion_link(course) if course else None
});
$("#feedback_form").submit(function() {
$("input[type='submit']", this).attr("disabled", "disabled");
$('area,input,select,textarea,button').attr('tabindex', -1);
$("#feedback_form_wrapper .close-modal").focus();
});
$("#feedback_form").on("ajax:complete", function() {
$("input[type='submit']", this).removeAttr("disabled");
......
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