Skip to content

Commit 5153b4d

Browse files
committed
Ensure data-bs-toggle is present in the BS3 tabset compatibility shims
Fixes #492
1 parent 85d07a6 commit 5153b4d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

inst/bs3compat/js/bs3compat.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ $(function() {
2727
var SELECTOR = '[data-toggle="tab"], [data-toggle="pill"], [data-bs-toggle="tab"], [data-bs-toggle="pill"]';
2828
$(document).on(EVENT_KEY, SELECTOR, function(event) {
2929
event.preventDefault();
30-
$(this).tab("show");
30+
var $this = $(this);
31+
// New (bs5+) tabs use only `data-bs-toggle`, so we provide fallback manually
32+
if (!$this.attr("data-bs-toggle") && $this.attr("data-toggle")) {
33+
$this.attr("data-bs-toggle", $this.attr("data-toggle"));
34+
}
35+
$this.tab("show");
3136
});
3237

3338
function TabPlugin(config) {

0 commit comments

Comments
 (0)