dreamRs / shinyWidgets

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

Bootstrap 5 compatibility issue: pickerInput() choices are not appearing #460

Closed GitHunter0 closed 2 months ago

GitHunter0 commented 2 years ago

Hi folks,

pickerInput() choices are not appearing when Bootstrap 5 is selected. Here is a MWE:

library(shiny)
library(shinyWidgets)

ui <- tagList(

    navbarPage(
        title = "Test",

        theme = bslib::bs_theme(version=5, bootswatch='default'),

        shinyWidgets::pickerInput(
                inputId = "id1",
                label="shinyWidgets::pickerInput() - choices DO NOT appear",
                choices = c("A", "B", "C"),
                multiple = FALSE,
                selected = "A"
        ),

        shiny::selectizeInput(
                inputId = "id2",
                label="shiny::selectizeInput() - choices DO appear"",
                choices = c("A", "B", "C"),
                multiple = FALSE,
                selected = "A"
        )

    )
)

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

}

shiny::shinyApp(ui=ui, server=server)

Thank you

R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

shinyWidgets_0.6.2 
shiny_1.7.1       
jonmcalder commented 2 years ago

FYI: Already mentioned here: https://github.com/dreamRs/shinyWidgets/issues/434

pvictor commented 2 years ago

I upgraded bootstrap-select 1.14.0-beta2 which is still a pre-release, but should work with Bootstrap 5.

moturoa commented 2 years ago

For me the update to 1.14.0-beta2 did not work, but I am not using a standard shiny page with a theme argument. We have our own Bootstrap 5.1 template with additional js/css. After making sure the 1.14.0-beta2 dependency is loaded by setting:

library(bslib)
bs5 <- bs_theme(version = 5)
bs_global_set(theme = bs5)
shiny::shinyOptions(bootstrapTheme = bs5)

there is a JS error on running the shiny app (causing the entire app to freeze) :

image