Skip to content

Commit

Permalink
add nav-item/nav-link to BS4+ dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed May 5, 2021
1 parent 7f81a7c commit 745bee2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
13 changes: 12 additions & 1 deletion R/bootstrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,18 @@ buildDropdown <- function(divTag, tabset) {
divTag$title,
tags$b(class = "caret")
),
navList
navList,
.renderHook = function(x) {
if (isTRUE(getCurrentThemeVersion() >= 4)) {
tagQuery(x)$
addClass("nav-item")$
find(".dropdown-toggle")$
addClass("nav-link")$
allTags()
} else {
x
}
}
)

list(
Expand Down
16 changes: 8 additions & 8 deletions tests/testthat/_snaps/tabPanel.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
B
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-value="Menu">
<li class="dropdown nav-item">
<a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown" data-value="Menu">
Menu
<b class="caret"></b>
</a>
Expand Down Expand Up @@ -121,8 +121,8 @@
B
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-value="Menu">
<li class="dropdown nav-item">
<a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown" data-value="Menu">
Menu
<b class="caret"></b>
</a>
Expand Down Expand Up @@ -204,8 +204,8 @@
B
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-value="Menu">
<li class="dropdown nav-item">
<a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown" data-value="Menu">
Menu
<b class="caret"></b>
</a>
Expand Down Expand Up @@ -284,8 +284,8 @@
B
</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" data-value="Menu">
<li class="dropdown nav-item">
<a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown" data-value="Menu">
Menu
<b class="caret"></b>
</a>
Expand Down

0 comments on commit 745bee2

Please sign in to comment.