Skip to content

nav-item for hidden_nav_panel adds vertical space to nav-bar on narrow window size #1215

Open
@CarabusAuratus

Description

@CarabusAuratus

Problem
When the nav-bar switches on narrow windows or devices to a list format (navbar_options = list(collapsible = FALSE)) nav items for hidden nav panels lead to increased vertical size of nav bar menu.
Additionally, when switched to the hidden panel, the corresponding nav-item is underlined.
It might be related to this issue.

The following example is based on the one in the linked issue 1117.

ui <- page_navbar(
  id = "app",
  navbar_options = list(collapsible = FALSE,
                        theme="dark"),
  nav_panel(
    title = "Tab 1",
    input_task_button("to_hidden_panel", "Go to hidden panel")
  ),
  nav_panel_hidden(
    value = "Tab 2",
    "Content"
  )
)

server <- function(input, output, session) {
  observeEvent(input$to_hidden_panel, {
    nav_select("app", selected = "Tab 2")
  })
}

shinyApp(ui, server)

Some session info

─ Session info ──────────────
 setting  value
 version  R version 4.4.3 (2025-02-28)
 os       Ubuntu 24.04.2 LTS
 system   x86_64, linux-gnu
 ui       RStudio
 language de_DE.UTF-8
 collate  de_DE.UTF-8
 ctype    de_DE.UTF-8
 tz       Etc/UTC
 date     2025-06-04
 rstudio  2024.12.1+563 Kousa Dogwood (server)
 pandoc   3.6.4 @ /usr/bin/pandoc
 quarto   1.5.57 @ /usr/local/bin/quarto

─ Packages ────────────
 package      * version date (UTC) lib source
 bslib        * 0.9.0   2025-01-30 [1] RSPM 
 htmltools      0.5.8.1 2024-04-04 [1] RSPM
 shiny        * 1.10.0  2024-12-14 [1] RSPM (R 4.4.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions