How to keep background elements available when a popup window is open

I am using a popup window in R Shiny with the following code:

library(shiny)

ui = basicPage(
  actionButton("show", "Show modal dialog"),

  textAreaInput(
    inputId = 'textEditor', 
    label   = NULL, 
    value   = "R is a free software environment for statistical computing and graphics.",
    height  = "300",
    resize  = "none"
  )
)

server = function(input, output) 
{
  observeEvent(input$show, 
  {
    showModal(modalDialog(
      title = "Add the following text in the box at the left:",
      "The R language is widely used among statisticians and data miners.",
  
      footer = tagList(
        actionButton("ok", "OK")
      )
    ))
  })

  observeEvent(input$ok, 
  {
    removeModal()
    print("OK") 
  })
}

shinyApp(ui = ui, server = server)

It strikes me that when the popup window is open, you can not use the elements on the background. The whole background is greyed-out.

In most cases this may be the right behaviour, but in my case I would like to be able to edit the text in the left window while the popup window is open.

Is it possible to make this possible? If so, how?

I tried adding this in the ui:

tags$head(tags$style(HTML("
    .modal {
      position: static !important;
    }"
  )))

but that made it even worse, while it turned out to be the solution in html (see: https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_modal ).

Any help is much appreciated.

According to wikipedia, what you describe is a modeless dialog rather than a modal dialog.

A modal window creates a mode that disables the main window but keeps it visible, with the modal window as a child window in front of it. Users must interact with the modal window before they can return to the parent application. This avoids interrupting the workflow on the main window. Modal windows are sometimes called heavy windows or modal dialogs because they often display a dialog box.

The opposite of modal is modeless . Modeless windows don't block the main window, so the user can switch their focus between them, treating them as palette windows.

I am not aware of any shiny support, or shiny addon that provides for such functionality at this time.
Possibly looking at how CRAN - Package mwshiny (r-project.org) might provide some ideas but I think mwshiny is somewhat too awkward to be practical in its current form, at least based on evidence of the vignette

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.