Commit 7b3f5e64 by Adam Palay

manage focus to/from/within password reset modal appropriately

parent 97b738bc
...@@ -32,9 +32,7 @@ ...@@ -32,9 +32,7 @@
</div> </div>
<a href="#" role="button" class="close-modal" title="${_('Close Modal')}"> <a href="#" role="button" class="close-modal" title="${_('Close Modal')}">
<div class="inner"> &#10005;
<p>&#10005;</p>
</div>
</a> </a>
</div> </div>
</section> </section>
...@@ -56,5 +54,27 @@ ...@@ -56,5 +54,27 @@
$('#login-modal .close-modal').click(function(e) { $('#login-modal .close-modal').click(function(e) {
e.preventDefault(); e.preventDefault();
}); });
var onModalClose = function() {
$(".forgot-password-modal .close-modal").off("click");
$("#lean_overlay").off("click");
$("#forgot-password-modal").attr("aria-hidden", "true");
$("#forgot-password-link").focus();
};
var cycle_modal_tab = function(from_element_name, to_element_name) {
$(from_element_name).on('keydown', function(e) {
var keyCode = e.keyCode || e.which;
if (keyCode === 9) {
e.preventDefault();
$(to_element_name).focus();
}
});
};
$(".forgot-password-modal .close-modal").click(onModalClose);
$("#forgot-password-modal").focus()
cycle_modal_tab(".forgot-password-modal .close-modal", "#pwd_reset_email")
cycle_modal_tab("#pwd_reset_email", "#pwd_reset_button")
cycle_modal_tab("#pwd_reset_button", ".forgot-password-modal .close-modal")
})(this) })(this)
</script> </script>
...@@ -67,6 +67,10 @@ ...@@ -67,6 +67,10 @@
$('.message.submission-error .message-copy').html(json.value); $('.message.submission-error .message-copy').html(json.value);
} }
}); });
$("#forgot-password-link").click(function() {
$(".forgot-password-modal .close-modal").focus()
})
})(this); })(this);
function toggleSubmitButton(enable) { function toggleSubmitButton(enable) {
...@@ -127,7 +131,7 @@ ...@@ -127,7 +131,7 @@
<label for="password">${_('Password')}</label> <label for="password">${_('Password')}</label>
<input id="password" type="password" name="password" value="" required aria-required="true" /> <input id="password" type="password" name="password" value="" required aria-required="true" />
<span class="tip tip-input"> <span class="tip tip-input">
<a href="#forgot-password-modal" rel="leanModal" class="pwd-reset action action-forgotpw" role="button" aria-haspopup="true">${_('Forgot password?')}</a> <a href="#forgot-password-modal" rel="leanModal" class="pwd-reset action action-forgotpw" id="forgot-password-link" role="button" aria-haspopup="true">${_('Forgot password?')}</a>
</span> </span>
</li> </li>
</ol> </ol>
......
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