rstudio / bslib

Tools for theming Shiny and R Markdown via Bootstrap 3, 4, or 5.
https://rstudio.github.io/bslib/
Other
459 stars 52 forks source link

Sidebar open parameter crash Shinylive when passing a list #1081

Closed cedricbouffard closed 1 month ago

cedricbouffard commented 1 month ago

When passing a list to the open parameter in a sidebar, shinylive will display this error: image

I tried with a named character vector, same problem.

Here's a sample code:

library(shiny)
library(bslib)

ui <- page_sidebar(

  sidebar = sidebar(
    open = list(desktop = "always", mobile = "open")
  ),
  mainPanel(
    "Test"
  )
)

server <- function(input, output, session) {

  }

shinyApp(ui, server)
gadenbuie commented 1 month ago

I wonder if there's an encoding issue? I just copied your example into shinylive and it worked as expected. (I edited it lightly in that link but the direct copy works as well.)

I noticed that the error message appears to say

Error: `open` must be one of "desktop", "open", "closed", or "always", not "always".

which seems to indicate there's a difference between "always" and "always"?

gadenbuie commented 1 month ago

Oh, actually I think I found the bug! I'm not sure which exact conditions produce the error, but I ran into it myself and know how to fix it :)