Skip to content

Error in virtualSelectInput when disabledOptions is length 1 #748

@asbatestw

Description

@asbatestw

virtualSelectInput leads to an error in virtual-select JS when disabling only 1 option.

Reprex:

ui <- list(
  shinyWidgets::virtualSelectInput(
    inputId = "test",
    label = "test",
    choices = c("A" = "a", "B" = "b", "C" = "c"),
    selected = "a",
    disabledOptions = c("b", "c") # this works
    # disabledOptions = "b" # this doesn't
  )

)

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

shiny::shinyApp(ui, server)

This app produces the following output (just the label)

Image

And a corresponding browser console error

Image

I think the issue is the auto_unbox = TRUE in this line. With auto_unbox = FALSE the vector gets turned into an array which is what virtual-select expects.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions