Skip to content

FR: Close automatically popover after selectInput is changed #1150

Open
@olivroy

Description

@olivroy
ui <- page_fixed(
  card(
    card_header(
      popover(
        uiOutput("region", inline = TRUE),
        title = "Choose a region",

        selectInput("region", label =  "Region", choices = c("USA", "Canada", "France"), selected = "Canada")
      )
    ),
    "The card body..."
  )
)

server <- function(input, output) {
  output$region <- renderUI({
    list(
      paste0("I chose ", input$region),
      bsicons::bs_icon("pencil-square")
    )
  })
}

shinyApp(ui, server)

I derived this from some examples in https://rstudio.github.io/bslib/articles/tooltips-popovers/index.html?q=hide#readupdate-visibility

I wonder if it would be possible to close the popover automatically after selection is made. Currently, only clicking on the X directly can close the popover. For me, ESC doesn't work to close it either.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions