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)
works as expected in a laptop-sized screen:
but it's reversed for small-width/mobile screens:
Note
This is a smaller problem than it appears because I suspect no-one (or very few people) are actually interested in the value of input$sidebarCollapsed. Rather, they just want the sidebar to look the same once they bookmark their app (which will happen as long as input$sidebarCollapsed has the same value, even if it is the wrong value). Nonetheless, this should be fixed.
This script:
works as expected in a laptop-sized screen:
but it's reversed for small-width/mobile screens:
Note
This is a smaller problem than it appears because I suspect no-one (or very few people) are actually interested in the value of
input$sidebarCollapsed
. Rather, they just want the sidebar to look the same once they bookmark their app (which will happen as long asinput$sidebarCollapsed
has the same value, even if it is the wrong value). Nonetheless, this should be fixed.