rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
892 stars 300 forks source link

fix #217: correct input$sidebarCollapsed value for edge cases #222

Closed bborgesr closed 7 years ago

bborgesr commented 7 years ago

Attach input$sidebarCollapsed value to the end of the sidebar transitions (instead of when the toggle button is clicked).

Repro:

library(shiny)
library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(), 
  dashboardSidebar(),
  dashboardBody(
    textOutput("res")
  )
)

server <- function(input, output, session) {
  output$res <- renderText({
    if (input$sidebarCollapsed) {
      "Sidebar is collapsed"
    } else {
      "Sidebar is expanded"
    }
  })
}

shinyApp(ui, server)
bborgesr commented 7 years ago

@wch This is rebased, updated and tested as much as I could think of... I think we're good to merge.