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

Compatibility for BS3 style content fading #6

Closed
cpsievert opened this issue Nov 22, 2019 · 3 comments · Fixed by #325
Closed

Compatibility for BS3 style content fading #6

cpsievert opened this issue Nov 22, 2019 · 3 comments · Fixed by #325
Labels
enhancement New feature or request

Comments

@cpsievert
Copy link
Collaborator

cpsievert commented Nov 22, 2019

Maybe not relevant for shiny, but is relevant for rmarkdown's .tabset-fade class. A minimal example:

library(htmltools)
browsable(withTags(body(
  bslib::bs_theme_dependencies(bslib::bs_theme(version = 4)),
  ul(
    class="nav nav-tabs", role="tablist",
    li(
      role="presentation", class="active",
      a(
        href="#home", "aria-controls" = "home", role="tab", "data-toggle"="tab",
        "Home"
      )
    ),
    li(
      role="presentation",
      a(
        href="#about", "aria-controls" = "about", role="tab", "data-toggle"="tab",
        "About"
      )
    )
  ),
  div(
    class="tab-content",
    div(
      role="tabpanel", class="tab-pane fade in active", id="home",
      "Foo"
    ),
    div(role="tabpanel", class="tab-pane fade", id="about",
        "Bar"
    )
  )
)))
@cpsievert cpsievert added the enhancement New feature or request label Sep 14, 2020
@cpsievert
Copy link
Collaborator Author

A workaround for this issue is to use BS4 nav markup (i.e., put .nav-link on <li>,.nav-link on <a> and place active on the <a> instead of the <li>):

browsable(withTags(body(
  bslib::bs_theme_dependencies(bslib::bs_theme(version = 4)),
  ul(
    class="nav nav-tabs", role="tablist",
    li(
      role="presentation", class="nav-item",
      a(
        href="#home", "data-toggle"="tab",
        class="nav-link active",
        role="tab", "aria-controls"="home",
        "Home"
      )
    ),
    li(
      role="presentation", class="nav-item",
      a(
        href="#about", "data-toggle"="tab",
        class="nav-link",
        role="tab", "aria-controls"="home",
        "About"
      )
    )
  ),
  div(
    class="tab-content",
    div(role="tabpanel", class="tab-pane fade in active", id="home", "Foo"),
    div(role="tabpanel", class="tab-pane fade", id="about", "Bar")
  )
)))

@cpsievert
Copy link
Collaborator Author

Note also that this doesn't appear to be an issue for bs_theme(version = 5)

cpsievert added a commit that referenced this issue Jun 4, 2021
* Close #6: legacy support for .nav .fade transitions

* Update news
@github-actions
Copy link

This issue has been automatically locked. If you believe you have found a related problem, please open a new issue (with a reproducible example or feature request) and link to this issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant