Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure data-bs-toggle is present in the BS3 tabset compatibility shims #501

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified R/sysdata.rda
Binary file not shown.
7 changes: 6 additions & 1 deletion inst/bs3compat/js/bs3compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ $(function() {
var SELECTOR = '[data-toggle="tab"], [data-toggle="pill"], [data-bs-toggle="tab"], [data-bs-toggle="pill"]';
$(document).on(EVENT_KEY, SELECTOR, function(event) {
event.preventDefault();
$(this).tab("show");
var $this = $(this);
// New (bs5+) tabs use only `data-bs-toggle`, so we provide fallback manually
if (!$this.attr("data-bs-toggle") && $this.attr("data-toggle")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bs namespace is actually configurable, and may change in a future, so let's see if there's a CSS variables we can read to get the actual namespace.

$this.attr("data-bs-toggle", $this.attr("data-toggle"));
}
$this.tab("show");
});

function TabPlugin(config) {
Expand Down