dreamRs / shinyWidgets

shinyWidgets : Extend widgets available in shiny
https://dreamrs.github.io/shinyWidgets/
GNU General Public License v3.0
833 stars 153 forks source link

HTML special characters in `choices` of `pickerInput` when using `choicesOpt` #682

Open bdbmax opened 7 months ago

bdbmax commented 7 months ago

The display of apostrophes (and &, >, <, ", ...) is not rendered correctly in the choices when using pickerInput with choicesOpt. It appears that the labels specified in the choices list are being escaped to their HTML entities.

image

This does not happen when choicesOpt is set to NULL. It seems like it is happening because of the htmltools::htmlEscape call with attribute = TRUE within the internal function pickerSelectOptions, called by pickerInput.

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  pickerInput(
    inputId = "my_picker",
    choices = list("Option's" = c("Option'1", "Option'2")),
    choicesOpt = list(disabled = c(TRUE, FALSE))
  )
)

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

shinyApp(ui = ui, server = server)