nav_insert has different classes than "native" nav_panel
Nobody has claimed this yet.
- Dominant language
- SCSS
- Stars
- 569
- Forks
- 72
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 5
Description
I was trying to insert nav_panels into a navset and noticed that inserted panels are different than navsets that are there from the beginning.
In specific, the inserted nav panels miss the html-fill-item html-fill-container classes.
A MWE would be this:
library(shiny)
library(bslib)
d <- div(
"A",
style = "background: red; height: 100%"
)
ui <- page_fluid(
actionButton("add", "Add 'Dynamic' tab"),
actionButton("remove", "Remove 'Foo' tab"),
navset_card_underline(
height = "80vh",
id = "tabs",
nav_panel("Hello", d),
nav_panel("Foo", d),
nav_panel("Bar", d)
)
)
server <- function(input, output) {
observeEvent(input$add, {
nav_insert(
"tabs", target = "Bar", select = TRUE,
nav_panel("Dynamic", d)
)
})
observeEvent(input$remove, {
nav_remove("tabs", target = "Foo")
})
}
shinyApp(ui, server)
The original tabs (Hello, Foo, Bar) are all full-height.
whereas the new dynamic panel is not full-height:
Changing the nav_insert to
nav_insert(
"tabs", target = "Bar", select = TRUE,
fix_fullscreen(nav_panel("Dynamic", card_body(d)))
)
the following function fixes it for me for the moment
fix_fullscreen <- function(x) {
shiny::tagAppendAttributes(x, class = "html-fill-item html-fill-container")
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the nav_insert and nav_panel entry points and reproduce the provided Shiny MWE. Compare the classes on panels created initially with those inserted dynamically; done means inserted panels receive the same full-height behavior without the user's fix_fullscreen workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100