Description:
When running the app below, the observeEvent is triggered by clicking Remove modal button but the modal does not dissapears.
The Shiny.addCustomMessageHandler('bsutils-modal is triggered but there seems to be some bootstrap issue when closing the modal.
The event hidden.bs.modal is not fired.
I tried to close the modal with bootstrap button below, but so far I did not managed to make it work.
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
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)
Description: When running the app below, the observeEvent is triggered by clicking Remove modal button but the modal does not dissapears.
The
Shiny.addCustomMessageHandler('bsutils-modal
is triggered but there seems to be some bootstrap issue when closing the modal.The event
hidden.bs.modal
is not fired.I tried to close the modal with bootstrap button below, but so far I did not managed to make it work.
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
Example: