Skip to content

Commit

Permalink
Merge pull request #553 from readium/feature/533ModalFocus
Browse files Browse the repository at this point in the history
Fixes #533 Focus trapping in Dialogs
  • Loading branch information
danielweck authored Jul 22, 2016
2 parents 4d0107b + 435e08f commit 926bd72
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 45 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"jath": "danielweck/jath",
"mathjax-single-file": "danielweck/MathJax-single-file",
"bootstrap": "3.x",
"bootstrap-accessibility-plugin": "latest",
"bootstrap-accessibility-plugin": "paypal/bootstrap-accessibility-plugin",
"hammerjs": "latest",
"jquery-hammerjs": "latest",
"screenfull": "latest",
Expand Down
2 changes: 1 addition & 1 deletion package/package_base.cson
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ devDependencies:

"bootstrap": '3.x'

"bootstrap-accessibility-plugin": 'latest'
"bootstrap-accessibility-plugin": 'paypal/bootstrap-accessibility-plugin'

"hammerjs": 'latest'

Expand Down
27 changes: 0 additions & 27 deletions src/js/EpubLibrary.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,6 @@ Helpers){

$('.details-dialog .modal-body').html(bodyStr);


$('#buttEpubDetailsDelete').on('keydown',function(evt) {
if(evt.which === 9 && !(evt.shiftKey | evt.ctrlKey | evt.metaKey | evt.altKey)) { // TAB pressed
evt.preventDefault();
$('#closeEpubDetailsCross').focus();
}
});
$('#closeEpubDetailsCross').on('keydown',function(evt) {
if(evt.which === 9 && evt.shiftKey) { // shift-TAB pressed
evt.preventDefault();
$('#buttEpubDetailsDelete').focus();
}
});

$('.details-dialog .delete').on('click', function(){
$('.details-dialog').modal('hide');
var success = function(){
Expand Down Expand Up @@ -461,19 +447,6 @@ Helpers){
canHandleDirectory : libraryManager.canHandleDirectory(),
strings: Strings
}));

$('#buttCancelAddEpub').on('keydown',function(evt) {
if(evt.which === 9 && !(evt.shiftKey | evt.ctrlKey | evt.metaKey | evt.altKey)) { // TAB pressed
evt.preventDefault();
$('#closeAddEpubCross').focus();
}
});
$('#closeAddEpubCross').on('keydown',function(evt) {
if(evt.which === 9 && evt.shiftKey) { // shift-TAB pressed
evt.preventDefault();
$('#buttCancelAddEpub').focus();
}
});

Versioning.getVersioningInfo(function(version){
$appContainer.append(AboutDialog({imagePathPrefix: moduleConfig.imagePathPrefix, strings: Strings, dateTimeString: version.dateTimeString, viewerJs: version.readiumJsViewer, readiumJs: version.readiumJs, sharedJs: version.readiumSharedJs, cfiJs: version.readiumCfiJs}));
Expand Down
12 changes: 0 additions & 12 deletions src/js/ReaderSettingsDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,6 @@ define(['./ModuleConfig', 'hgn!readium_js_viewer_html_templates/settings-dialog.
$("#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
4 changes: 2 additions & 2 deletions src/templates/add-epub-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ <h4 class="modal-title" id="add-epub-label">{{strings.i18n_add_book}}</h4>
</form>
</div>
<div class="modal-footer">
<button id="buttAddEpub" tabindex="1000" type="button" class="btn btn-default add-book" data-dismiss="modal" disabled="disabled">{{strings.i18n_add_book}}</button>
<button tabindex="1000" type="button" class="btn btn-default add-book" data-dismiss="modal" disabled="disabled">{{strings.i18n_add_book}}</button>

<button id="buttCancelAddEpub" tabindex="1000" type="button" class="btn btn-primary" data-dismiss="modal">{{strings.i18n_cancel}}</button>
<button tabindex="1000" type="button" class="btn btn-primary" data-dismiss="modal">{{strings.i18n_cancel}}</button>
</div>
</div>
<!-- /.modal-content -->
Expand Down
4 changes: 2 additions & 2 deletions src/templates/details-body.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ <h4 class="modal-title" id="epub-details-label">HEADER</h4>
<div class="no-cover" style="background-image: url('{{data.noCoverBackground}}')"><p>{{data.title}}</p></div>
{{/data.coverHref}}
<div class="buttons">
<button id="buttEpubDetailsRead" tabindex="1000" class="btn btn-default read" data-dismiss="modal" data-book="{{data.rootUrl}}" type="button">{{strings.i18n_read}}</button>
<button id="buttEpubDetailsDelete" tabindex="1000" class="btn btn-danger delete" data-dismiss="modal" type="button">{{strings.i18n_delete}}</button>
<button tabindex="1000" class="btn btn-default read" data-dismiss="modal" data-book="{{data.rootUrl}}" type="button">{{strings.i18n_read}}</button>
<button tabindex="1000" class="btn btn-danger delete" data-dismiss="modal" type="button">{{strings.i18n_delete}}</button>
</div>
</div>
<div class='modal-book-info'>
Expand Down

0 comments on commit 926bd72

Please sign in to comment.