the-y-company / bsutils

Utilities for Bootstrap 5
Other
32 stars 2 forks source link

modal_hide() is not hiding the modal #4

Closed mauromiguelm closed 7 months ago

mauromiguelm commented 7 months ago

Description: When running the app below, the observeEvent is triggered by clicking Remove modal button but the modal does not dissapears.

Example:

library(shiny)
library(bsutils)
ui <- fluidPage(
  theme = bslib::bs_theme(version = 5L),
  actionButton("show", "Show modal"),
  modal(
    id = "modal",
    modalHeader(
      modalTitle("Title")
    ),
    modalBody(
      p("The content of the modal"),
      actionButton("remove", "Remove modal")
    ),
    modalFooter(
      p("The footer of the modal")
    )
  )
)
server <- \(input, output, session){
  observeEvent(input$show, {
    bsutils::modal_show("modal")
  })
  observeEvent(input$remove, {
    print("Removing modal")
    bsutils::modal_hide("modal")
  })
}

shinyApp(ui, server)
JohnCoene commented 7 months ago

Thanks for submitting this. Can you check if my latest push fixes it?

mauromiguelm commented 7 months ago

Thanks for submitting this. Can you check if my latest push fixes it?

Hi John, just opened a PR with a minor fix.