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

fixes switchInput not starting on ON with value = TRUE #464

Merged
merged 1 commit into from
Jan 14, 2022

Conversation

andyquinterom
Copy link
Contributor

I don't know how this interfeers with the bslib customization as newly implemented. I would have to read the boostrap-switch code in-depth to validate it. However, this seems to work by usuing bslib themes.

This works as expected:

library(shiny)
library(shinyWidgets) # On #454 

shinyApp(
  fluidPage(switchInput("si", "switchInput", offStatus = "primary"), theme = bslib::bs_theme(primary = "#ff0000")),
  function(input, output, session) {}
)

@pvictor
Copy link
Member

pvictor commented Jan 13, 2022

Thanks @andyquinterom
@AshesITR what do you think ?
The bug is caused by check attribute being ignored, that's reported here
Apparently adding a .trigger('change') in the initialization method of the Javascript bindings might resolve the issue

@AshesITR
Copy link
Contributor

Sounds reasonable to downgrade to BS 3.3.4, since it's an upstream bug.

@andyquinterom
Copy link
Contributor Author

Great to hear! I've been testing things out the downgrade does not seem to affect the functionality

@AshesITR
Copy link
Contributor

I've successfully tested this PR with bs4Dash.
MWE:

library(shiny)
library(bs4Dash)
library(shinyWidgets)

shinyApp(
  dashboardPage(
    freshTheme = fresh::create_theme(fresh::bs4dash_status(primary = "#ff0000")),
    header = dashboardHeader(),
    body = dashboardBody(
      switchInput("si", "switchInput", value = TRUE)
    ),
    sidebar = dashboardSidebar()
  ),
  function(input, output, session) {}
)

I haven't gotten shinydashboard to take a theme though, it seems not to use the theme from shinyOptions(bootstrapTheme = bslib::bs_theme(primary = "#ff0000")).
Any ideas for an MWE using shinydashboard instead of bs4Dash?

@pvictor pvictor merged commit 475dcb3 into dreamRs:master Jan 14, 2022
@pvictor
Copy link
Member

pvictor commented Jan 14, 2022

Thank you both.

No theming in shinydashboard or bs4Dash don't work as with bslib unfortunately

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

Successfully merging this pull request may close these issues.

3 participants