Skip to content

Commit ee99cab

Browse files
committed
Enable tab access of modals
1 parent 9d28cd6 commit ee99cab

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ <h1 class="extra-large no-style">LOKOLE: EMAIL FOR ALL</h1>
6969
<img src="static/nzola.jpg" class="img-thumbnail img-responsive" id="about-img" alt="Photo of Nzola" />
7070
<div class="medium" id="modals">
7171

72-
<div class="thumbnail" rel="modal" id="info1" data-toggle="tooltip" title="more history" data-reference="modal-1-content" data-title="The foundations that led to Ascoderu">
72+
<div class="thumbnail" rel="modal" id="info1" data-toggle="tooltip" title="more history" data-reference="modal-1-content" data-title="The foundations that led to Ascoderu" tabindex="0">
7373
<p>Hi, I’m Nzola Swasisa but please call me Nzola. I was born
7474
and raised in the DRC and in 2010 I founded Ascoderu: our
7575
canadian-congolese NGO. <em>Click to read more.</em></p>
@@ -91,7 +91,7 @@ <h1 class="extra-large no-style">LOKOLE: EMAIL FOR ALL</h1>
9191
</div>
9292
</div>
9393

94-
<div class="thumbnail" rel="modal" id="info2" data-toggle="tooltip" title="more history" data-reference="modal-2-content" data-title="The history of Ascoderu and Lokole">
94+
<div class="thumbnail" rel="modal" id="info2" data-toggle="tooltip" title="more history" data-reference="modal-2-content" data-title="The history of Ascoderu and Lokole" tabindex="0">
9595
<p>Between 2013-15 I went to Kinshasa in order to test
9696
REC (Remote Email Center) and the proof-of-concept led to Lokole. <em>Click to read more.</em></p>
9797

src/script.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,24 @@
3333
}
3434

3535
function setupModals() {
36-
$('div[rel="modal"]').click(function() {
36+
$('div[rel="modal"]').on('click keydown', function(event) {
37+
if (event.which !== 1 && event.which !== 13) {
38+
return;
39+
}
40+
3741
var $clicked = $(this);
3842
var clickedModalId = $clicked.data('reference');
3943
var contentModalHtml = $('#' + clickedModalId).html();
4044

41-
BootstrapDialog.show({
45+
var dialog = BootstrapDialog.show({
46+
onhidden: function() {
47+
$clicked.focus();
48+
},
4249
title: $clicked.data('title'),
4350
message: $('<div/>').append(contentModalHtml)
4451
});
52+
53+
dialog.$modal.focus();
4554
});
4655
}
4756

0 commit comments

Comments
 (0)