Closed fredericva closed 2 months ago
Thanks for the report @fredericva! The bug is that we refactored the code to clean up the internal implementation and are now sending a method = "closed"
message to the server when it should be method = "close"
. I'll have a PR to fix this up shortly.
Here's a complete, minimal reprex:
library(shiny)
library(bslib)
# pkgload::load_all()
ui <- page_navbar(
id = "page",
sidebar = sidebar(
id = "global",
open = "closed"
),
nav_panel("one", "Page one"),
nav_panel("two", "Page two"),
nav_panel("three", "Page three")
)
server <- function(input, output, session) {
observeEvent(input$page, {
toggle_sidebar("global", input$page != "one")
})
}
shinyApp(ui, server)
This issue has been automatically locked. If you have found a related problem, please open a new issue (with a reproducible example or feature request) and link to this issue. :raising_hand: Need help? Connect with us on Discord or Posit Community.
We just updated bslib from 0.6.1 to 0.7 and noticed a change (possibly a bug) in the behaviour of toggle_sidebar()
We develop an app in shiny using bslib and rhino, In our code, we have a global sidebar which is closed by default and opened only in certain pages. With the new version the sidebar starts closed, but as soon as it opens, it doesn't close when we navigate to a page where it should be.
when we loanch the app (in page1), the sidebar is closed, when we navigate to page2, sidebar opens, but when we go back in page1, even if the "closed" part of the code runs, the sidebar stays open.