Skip to content

Commit

Permalink
Fixes # 146
Browse files Browse the repository at this point in the history
Added onkeydown trap of shift-tab/tab on first and last elements
in settings to keep focus in dialog until closed.
  • Loading branch information
Becky Gibson committed Aug 15, 2014
1 parent 42e7134 commit a01abd3
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/ReaderSettingsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ define(['hgn!templates/settings-dialog.html', 'ReaderSettingsDialog_Keyboard', '
$("#tab-main").attr('aria-expanded', "false");
$("#tab-keyboard").attr('aria-expanded', "true");
});
$('#buttSave').on('keydown',function(evt) {
if(evt.which === 9 && !(evt.shiftKey | evt.ctrlKey | evt.metaKey | evt.altKey)) { // TAB pressed
evt.preventDefault();
$('#closeSettingsCross').focus();
}
});
$('#closeSettingsCross').on('keydown',function(evt) {
if(evt.which === 9 && evt.shiftKey) { // shift-TAB pressed
evt.preventDefault();
$('#buttSave').focus();
}
});

$('#settings-dialog').on('hide.bs.modal', function(){ // IMPORTANT: not "hidden.bs.modal"!! (because .off() in

Expand Down

0 comments on commit a01abd3

Please sign in to comment.