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

pickerInput: strange behaviour with disabling individual options when some are grouped #650

Closed
sharlagelfand opened this issue Dec 27, 2023 · 2 comments

Comments

@sharlagelfand
Copy link

Hi! I'm running into an issue with pickerInput where disabling individual options works strangely if there are grouped options.

In the example below, the first input should have just "two" (which is in a group) disabled, and this works. The second input should have "two" (in a group) and "five" (not in a group) disabled - it does not work, only "two" is disabled. The third input should have "two" and "three" (both in a group together) disabled - this does not work, as "two", "three", and "four" are all disabled.

Not sure if I'm missing how to disable options properly, but the behaviour seems a bit odd and not consistent. Thank you - happy holidays and new year!

library(shiny)
library(shinyWidgets)

choices <- list(
  "one",
  "group" = list("two", "three"),
  "four",
  "five"
)

ui <- fluidPage(
  pickerInput(
    inputId = "p1",
    label = "only one grouped option disabled (just 'two' disabled)",
    choices = choices,
    choicesOpt = list(
      disabled = c(FALSE, TRUE, FALSE, FALSE, FALSE)
    )
  ),
  pickerInput(
    inputId = "p2",
    label = "one grouped option, one non-grouped option disabled ('two' and 'five' disabled)",
    choices = choices,
    choicesOpt = list(
      disabled = c(FALSE, TRUE, FALSE, FALSE, TRUE)
    )
  ),
  pickerInput(
    inputId = "p3",
    label = "all (and only) group options disabled ('two', 'three' disabled)",
    choices = choices,
    choicesOpt = list(
      disabled = c(FALSE, TRUE, TRUE, FALSE, FALSE)
    )
  )
)

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

shinyApp(ui = ui, server = server)
@pvictor
Copy link
Member

pvictor commented Dec 28, 2023

Thanks for reporting the issue, should be fixed if you re-install from GitHub. Grouped choices caused a shift in choicesOpt used.

Bonnes fêtes 🎉

Victor

@sharlagelfand
Copy link
Author

Thank you for such a speedy fix - works great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants