-
Notifications
You must be signed in to change notification settings - Fork 336
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
Update markup of BS5 tabs + conditional TOC JS inclusion #1890
Conversation
@@ -23,6 +23,10 @@ | |||
render_page <- function(pkg = ".", name, data, path = "", depth = NULL, quiet = FALSE) { | |||
pkg <- as_pkgdown(pkg) | |||
|
|||
if (is.null(data$has_toc)) { | |||
data$has_toc <- TRUE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing I only tested quickly is creating a vignette with tabsets and no h2: then the tabs work because there's a TOC even if it's empty.
Do you mind pulling the tabs markup change into a separate PR? I'd want to contemplate the tabs fix a bit more before we apply it — it introduces quite a lot of additional complexity in order to fix a pretty minor bug. |
👍 See #1903 |
I was also thinking it's a good thing we now set the active class in the navbar via HTML tweaks. 😅 (or maybe there could still be a bug there one day) Things that can get an active class in a pkgdown page:
|
For the record I re-read https://afeld.github.io/bootstrap-toc/ and didn't see any relevant configuration to change. If I were to make this PR today, I wouldn't use logic inside templates but instead add a tweak that'd add the TOC JS when there's a TOC. 🤷♀️ |
See #1959 (comment) by @gadenbuie |
Fix #1889
Also fixes the tabs markup to comply with https://getbootstrap.com/docs/5.1/components/navs-tabs/#javascript-behavior