Open mine-cetinkaya-rundel opened 7 years ago
Wanted to chime in and mention that there is a way to make the modal movable by using the excellent shinyjqui
package. Here's a minimal example demonstrating the functionality taken from the solution at this issue:
library(shiny)
library(shinyjqui)
ui <- fluidPage(
includeJqueryUI(),
titlePanel("Old Faithful Geyser Data"),
sidebarLayout(
sidebarPanel(
actionButton("show", "Show modal dialog")
),
mainPanel(
h1("hello")
)
)
)
server <- function(input, output, session) {
observeEvent(input$show, {
showModal(modalDialog(
title = "Important message",
"This is an important message!",
easyClose = TRUE
))
jqui_draggable(selector = '.modal-content')
})
}
shinyApp(ui = ui, server = server)
@thercast Just tried this out, and can confirm that this works well, thanks!
I do think it would be useful to integrate this as a default behavior for modal dialogs regardless, but good to know that this is a solved with the shinyjqui
package.
Hi all - thank you for this very useful thread, almost 5 years on!
I thought it was probably worth mentioning for anyone else stumbling on this issue, that the above solution posted by @rpodcast doesn't work anymore (at least for me it didn't), but that the shinyjqui
package now has a function draggableModalDialog()
which directly replaces modalDialog()
, making the modals draggable as expected.
Wouldn't have found it without this thread though - thanks again!
Modal dialogs sometimes can cover the app when they pop up (in the case of a bookmarking dialog, or otherwise). It would be nice to have the functionality to drag and move them away a la http://stackoverflow.com/questions/27120579/jquery-draggable-with-bootstrap-modal-scroller-strange-behaviour.