Skip to content

Commit e7e0cb9

Browse files
committed
Tabindex is a customizable option now.
1 parent d38c85f commit e7e0cb9

File tree

7 files changed

+93
-11
lines changed

7 files changed

+93
-11
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
LASTEST NOT RELEASED
22
------------------------------
33
* Merged #137, Add missing less and remove stray css file in src folder *
4+
* Tabindex is a customizable option now. *
45
* Refs #142 *
56
* Refs #145 *
67

dist/js/bootstrap-dialog.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@
236236
autodestroy: true,
237237
draggable: false,
238238
animate: true,
239-
description: ''
239+
description: '',
240+
tabindex: -1
240241
};
241242

242243
/**
@@ -347,8 +348,9 @@
347348
return this;
348349
},
349350
createModal: function() {
350-
var $modal = $('<div class="modal" tabindex="-1" role="dialog" aria-hidden="true"></div>');
351-
$modal.prop('id', this.getId()).attr('aria-labelledby', this.getId() + '_title');
351+
var $modal = $('<div class="modal" role="dialog" aria-hidden="true"></div>');
352+
$modal.prop('id', this.getId());
353+
$modal.attr('aria-labelledby', this.getId() + '_title');
352354

353355
return $modal;
354356
},
@@ -687,6 +689,21 @@
687689

688690
return this;
689691
},
692+
setTabindex: function(tabindex) {
693+
this.options.tabindex = tabindex;
694+
695+
return this;
696+
},
697+
getTabindex: function() {
698+
return this.options.tabindex;
699+
},
700+
updateTabindex: function() {
701+
if (this.isRealized()) {
702+
this.getModal().attr('tabindex', this.getTabindex());
703+
}
704+
705+
return this;
706+
},
690707
getDefaultText: function() {
691708
return BootstrapDialog.DEFAULT_TEXTS[this.getType()];
692709
},
@@ -1079,6 +1096,7 @@
10791096
this.updateClosable();
10801097
this.updateAnimate();
10811098
this.updateSize();
1099+
this.updateTabindex();
10821100

10831101
return this;
10841102
},

dist/js/bootstrap-dialog.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/assets/bootstrap-dialog/js/bootstrap-dialog.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@
236236
autodestroy: true,
237237
draggable: false,
238238
animate: true,
239-
description: ''
239+
description: '',
240+
tabindex: -1
240241
};
241242

242243
/**
@@ -347,8 +348,9 @@
347348
return this;
348349
},
349350
createModal: function() {
350-
var $modal = $('<div class="modal" tabindex="-1" role="dialog" aria-hidden="true"></div>');
351-
$modal.prop('id', this.getId()).attr('aria-labelledby', this.getId() + '_title');
351+
var $modal = $('<div class="modal" role="dialog" aria-hidden="true"></div>');
352+
$modal.prop('id', this.getId());
353+
$modal.attr('aria-labelledby', this.getId() + '_title');
352354

353355
return $modal;
354356
},
@@ -687,6 +689,21 @@
687689

688690
return this;
689691
},
692+
setTabindex: function(tabindex) {
693+
this.options.tabindex = tabindex;
694+
695+
return this;
696+
},
697+
getTabindex: function() {
698+
return this.options.tabindex;
699+
},
700+
updateTabindex: function() {
701+
if (this.isRealized()) {
702+
this.getModal().attr('tabindex', this.getTabindex());
703+
}
704+
705+
return this;
706+
},
690707
getDefaultText: function() {
691708
return BootstrapDialog.DEFAULT_TEXTS[this.getType()];
692709
},
@@ -1079,6 +1096,7 @@
10791096
this.updateClosable();
10801097
this.updateAnimate();
10811098
this.updateSize();
1099+
this.updateTabindex();
10821100

10831101
return this;
10841102
},

examples/assets/bootstrap-dialog/js/bootstrap-dialog.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/play/tabindex.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<script src="../assets/jquery/jquery-1.10.2.min.js"></script>
5+
<link href="../assets/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
6+
<script src="../assets/bootstrap/js/bootstrap.min.js"></script>
7+
<link href="../assets/bootstrap-dialog/css/bootstrap-dialog.min.css" rel="stylesheet" type="text/css" />
8+
<script src="../assets/bootstrap-dialog/js/bootstrap-dialog.min.js"></script>
9+
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
10+
<title>Tabindex</title>
11+
<meta charset="utf-8" />
12+
</head>
13+
<body>
14+
<script type="text/javascript">
15+
/**
16+
* This example demonstrates how to custom tabindex attribute of the dialog.
17+
*/
18+
$(function() {
19+
var dialog = new BootstrapDialog({
20+
message: 'Custom tabindex.',
21+
tabindex: 10
22+
});
23+
dialog.open();
24+
});
25+
</script>
26+
</body>
27+
</html>

src/js/bootstrap-dialog.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@
236236
autodestroy: true,
237237
draggable: false,
238238
animate: true,
239-
description: ''
239+
description: '',
240+
tabindex: -1
240241
};
241242

242243
/**
@@ -347,8 +348,9 @@
347348
return this;
348349
},
349350
createModal: function() {
350-
var $modal = $('<div class="modal" tabindex="-1" role="dialog" aria-hidden="true"></div>');
351-
$modal.prop('id', this.getId()).attr('aria-labelledby', this.getId() + '_title');
351+
var $modal = $('<div class="modal" role="dialog" aria-hidden="true"></div>');
352+
$modal.prop('id', this.getId());
353+
$modal.attr('aria-labelledby', this.getId() + '_title');
352354

353355
return $modal;
354356
},
@@ -687,6 +689,21 @@
687689

688690
return this;
689691
},
692+
setTabindex: function(tabindex) {
693+
this.options.tabindex = tabindex;
694+
695+
return this;
696+
},
697+
getTabindex: function() {
698+
return this.options.tabindex;
699+
},
700+
updateTabindex: function() {
701+
if (this.isRealized()) {
702+
this.getModal().attr('tabindex', this.getTabindex());
703+
}
704+
705+
return this;
706+
},
690707
getDefaultText: function() {
691708
return BootstrapDialog.DEFAULT_TEXTS[this.getType()];
692709
},
@@ -1079,6 +1096,7 @@
10791096
this.updateClosable();
10801097
this.updateAnimate();
10811098
this.updateSize();
1099+
this.updateTabindex();
10821100

10831101
return this;
10841102
},

0 commit comments

Comments
 (0)