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

nav_insert not creating fillable tabs #952

Open
lukebandy opened this issue Dec 21, 2023 · 7 comments
Open

nav_insert not creating fillable tabs #952

lukebandy opened this issue Dec 21, 2023 · 7 comments

Comments

@lukebandy
Copy link

lukebandy commented Dec 21, 2023

nav_panels inserted progmatically using nav_insert() are not fillable.

'Page 1' has class tab-pane html-fill-item html-fill container bslib-gap-spacing, whilst the new 'Page 2' just has class tab-pane.

library(bslib)

ui <- page_navbar(
    id = 'nav',
    nav_panel('Page 1',
              card("Content 1")))

server <- function(input, output, session) {
    nav_insert(id = "nav",
               nav = nav_panel('Page 2',
                               card("Content 2")))
}

shinyApp(ui, server)

Session Info

version R version 4.3.2 (2023-10-31 ucrt)
os Windows 10 x64 (build 19045)
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United Kingdom.utf8
ctype English_United Kingdom.utf8
tz Europe/London
date 2023-12-21
rstudio 2023.09.1+494 Desert Sunflower (desktop)
pandoc NA

─ Packages ───────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
bslib * 0.6.1 2023-11-28 [1] CRAN (R 4.3.2)
cachem 1.0.8 2023-05-01 [1] CRAN (R 4.3.1)
callr 3.7.3 2022-11-02 [1] CRAN (R 4.3.1)
cli 3.6.1 2023-03-23 [1] CRAN (R 4.2.3)
colorspace 2.1-0 2023-01-23 [1] CRAN (R 4.3.1)
crayon 1.5.2 2022-09-29 [1] CRAN (R 4.2.3)
devtools 2.4.5 2022-10-11 [1] CRAN (R 4.2.2)
digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.1)
dplyr 1.1.3 2023-09-03 [1] CRAN (R 4.3.1)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.3)
fansi 1.0.5 2023-10-08 [1] CRAN (R 4.3.1)
fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.1)
fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.1)
generics 0.1.3 2022-07-05 [1] CRAN (R 4.1.3)
ggplot2 3.4.4 2023-10-12 [1] CRAN (R 4.3.1)
glue 1.6.2 2022-02-24 [1] CRAN (R 4.1.3)
gtable 0.3.4 2023-08-21 [1] CRAN (R 4.3.1)
htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.2)
htmlwidgets 1.6.2 2023-03-17 [1] CRAN (R 4.3.1)
httpuv 1.6.11 2023-05-11 [1] CRAN (R 4.3.1)
jquerylib 0.1.4 2021-04-26 [1] CRAN (R 4.1.3)
jsonlite 1.8.7 2023-06-29 [1] CRAN (R 4.2.3)
later 1.3.0 2021-08-18 [1] CRAN (R 4.1.3)
lifecycle 1.0.3 2022-10-07 [1] CRAN (R 4.2.3)
magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.1.3)
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.2.3)
mime 0.12 2021-09-28 [1] CRAN (R 4.1.1)
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.1.3)
munsell 0.5.0 2018-06-12 [1] CRAN (R 4.1.3)
pillar 1.9.0 2023-03-22 [1] CRAN (R 4.2.3)
pkgbuild 1.4.2 2023-06-26 [1] CRAN (R 4.3.1)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.3)
pkgload 1.3.3 2023-09-22 [1] CRAN (R 4.3.1)
prettyunits 1.2.0 2023-09-24 [1] CRAN (R 4.3.1)
processx 3.8.2 2023-06-30 [1] CRAN (R 4.3.1)
profvis 0.3.8 2023-05-02 [1] CRAN (R 4.3.1)
promises 1.2.1 2023-08-10 [1] CRAN (R 4.3.1)
ps 1.7.5 2023-04-18 [1] CRAN (R 4.3.1)
purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.1)
R6 2.5.1 2021-08-19 [1] CRAN (R 4.1.3)
Rcpp 1.0.11 2023-07-06 [1] CRAN (R 4.3.1)
remotes 2.4.2.1 2023-07-18 [1] CRAN (R 4.3.1)
rlang 1.1.1 2023-04-28 [1] CRAN (R 4.2.3)
rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.2.3)
sass 0.4.7 2023-07-15 [1] CRAN (R 4.3.1)
scales 1.2.1 2022-08-20 [1] CRAN (R 4.2.3)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.1.3)
shiny * 1.7.5.1 2023-10-14 [1] CRAN (R 4.3.1)
stringi 1.7.12 2023-01-11 [1] CRAN (R 4.3.0)
stringr 1.5.0 2022-12-02 [1] CRAN (R 4.2.3)
tibble 3.2.1 2023-03-20 [1] CRAN (R 4.2.3)
tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.3)
urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.1.3)
usethis 2.2.2 2023-07-06 [1] CRAN (R 4.3.1)
utf8 1.2.3 2023-01-31 [1] CRAN (R 4.3.1)
vctrs 0.6.3 2023-06-14 [1] CRAN (R 4.2.3)
withr 2.5.1 2023-09-26 [1] CRAN (R 4.3.1)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.1.3)

@alanfarahani
Copy link

I continue to have this issue and can confirm that it is ongoing in the latest development version bslib * 0.6.1.9001 2024-03-16 Github (rstudio/bslib@43d46da).

Perhaps there's a temporary workaround using .addClass()?

@alanfarahani
Copy link

For anyone looking for an answer to this, see the SO post here.

You can pass the style and class arguments directly to the inserted nav_panel. Like so:

library(shiny)
library(bslib)

ui <- page_navbar(
    id = 'nav',
    nav_panel('Page 1',
              card("Content 1")))

server <- function(input, output, session) {
    nav_insert(id = "nav",
               nav = nav_panel('Page 2',
                               class = "html-fill-item html-fill-container bslib-gap-spacing",
                               style = "--bslib-navbar-margin:0;",
                               card("Content 2")))
}

shinyApp(ui, server)

The documentation for nav-items does not explicitly mention this, so far as I can see.

@lukebandy
Copy link
Author

@alanfarahani I finally had some time to look at your solution and it works perfectly 🤘

@gadenbuie
Copy link
Member

Thanks for posting a workaround @alanfarahani! I'm going to reopen this issue so that we can consider improving the API here in the future.

@gadenbuie gadenbuie reopened this Apr 3, 2024
@alanfarahani
Copy link

Great, glad it works @lukebandy!

And @gadenbuie, I'm not sure if it's worth opening a new issue, but tooltips do not work in panels created by nav_insert.

@gadenbuie
Copy link
Member

@alanfarahani Are you using the latest version of bslib? I believe that issue was reported in #1019 and has been fixed in the just-released version of bslib. If not, please do open a new issue 😄

@alanfarahani
Copy link

@gadenbuie Yes tooltips do indeed work in nav_insert panels for v. 0.70 just released on 2024-03-29. Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants