Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidebar collapsed/expanded is reversed for small width/mobile #217

Closed
bborgesr opened this issue Jun 1, 2017 · 1 comment
Closed

Sidebar collapsed/expanded is reversed for small width/mobile #217

bborgesr opened this issue Jun 1, 2017 · 1 comment
Assignees

Comments

@bborgesr
Copy link
Contributor

@bborgesr bborgesr commented Jun 1, 2017

This script:

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:
screen shot 2017-05-21 at 9 40 22 pm
screen shot 2017-05-21 at 9 40 29 pm

but it's reversed for small-width/mobile screens:

image 1
image

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.

@bborgesr
Copy link
Contributor Author

@bborgesr bborgesr commented Jun 1, 2017

Since this is due to CSS @media queries, I'm thinking of trying to detect them directly through Javascript, along these lines: http://zerosixthree.se/detecting-media-queries-with-javascript/

@bborgesr bborgesr added the in progress label Jun 6, 2017
bborgesr added a commit that referenced this issue Jun 6, 2017
…ar transitions (instead of when the toggle button is clicked).
@bborgesr bborgesr self-assigned this Jun 6, 2017
bborgesr added a commit that referenced this issue Jun 9, 2017
…ar transitions (instead of when the toggle button is clicked).
@bborgesr bborgesr closed this in 1c5a312 Jun 14, 2017
@bborgesr bborgesr removed the in progress label Jun 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.