rstudio / rstudio/bslib

Make navbar toggler automatically collapse on tab selection

Open
#969 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SCSS
Stars
569
Forks
72
Avg merge
1d 2h
Merged PRs (30d)
5

Description

When using page_navbar with a collection of nav_panels on mobile (I think breakpoint is 992px), the navbar switches to a toggler.
I would expect the toggler to automatically collapse when selecting a new nav_panel, however it does not.
Am I missing something or is it normal behaviour ? In the latter case, could you add a feature for this ?

Thanks for your help on this topic !

Code :

library(bslib)

ui <- page_navbar(
    title = "My app",
    nav_spacer(),
    nav_panel("Page 1", h1("Page 1")),
    nav_panel("Page 2", h1("Page 2")),
    nav_spacer(),
    collapsible = TRUE,
    fluid = TRUE
)
server <- function(input, output, session) {
}

shinyApp(ui = ui, server = server)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the supplied page_navbar example with collapsible=TRUE on a mobile-sized viewport, then trace the page_navbar and nav_panel behavior involved in tab selection. Done means selecting a nav_panel also collapses the mobile navbar toggler without disrupting navigation.

Written by the indexing model from the issue text.

Assessment

Tech stack
bootstrap, r, scss
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.