rstudio / rstudio/bslib

Input inside popover disappears after toggle_popover

Open
#1,213 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SCSS
Stars
569
Forks
72
Avg merge
1d 2h
Merged PRs (30d)
5

Description

Describe the problem

I came across an issue where an input disappears that seems to be related to the specific combination of inputs that I use in my popover. In the example below, I have a popover that contains a selectizeInput with a tooltip and a 'Edit' button which opens a modal. When the modal is open, the popover is still visible and in my real app overlays the modal content , so I close it with toggle_popover when the 'Edit' button is clicked.

Image

However, when closing the popover using toggle_popover, the first selectizeInput inside the popover disappears when reopening the popover the next time.

Image

This behavior only seems to occur for the specific combination of tooltip, actionButton that is part of the input label and using toggle_popover to close the popover. Either manually closing the popover, or removing the tooltip around the selectizeInput, or using the 'Open Modal' button instead of the 'Edit' button to trigger opening of the modal all result in the expected behavior where the input does not disappear.

# Include a minimal and reproducible example here
library(shiny)
library(bslib)
library(bsicons)

ui <- bslib::page_fillable(
  bslib::popover(
    id = "test.popover",
    trigger = bsicons::bs_icon(name = "house-gear-fill"),

    # removing this tooltip results in the expected behavior
    bslib::tooltip( 
      shiny::selectizeInput(
        inputId = "disappearing.input",
        label = shiny::span("Input that disappears",
                            # moving the actionButton to a place outside the label also results in the expected behavior
                            shiny::actionButton("edit", "Edit", class = "btn-sm ms-5")),
        choices = letters[1:3],
        selected = NULL
      ),
      "Example tooltip text"
    ),
    bslib::tooltip(
      trigger = shiny::selectizeInput("other.input", "Other input", choices = letters[1:3], selected = NULL),
      "Example tooltip text"
    ),
    shiny::actionButton("open.modal", label = "Open Modal")
  )
)

server <- function(input, output, session){
  
  observeEvent({
    # triggering this event with the 'edit' button causes selectizeInput to disappear when reopening the popover
    input$edit
    # triggering this event with the 'open.modal' button instead results in the expected behavior
    # input$open.modal
  }, {
    
    # removing this line and manually closing the popover also results in the expected behavior
    bslib::toggle_popover(id = "test.popover", show = FALSE)
    
    showModal(
      modalDialog(title = "Edit Modal")
    )
  })
  
}

shinyApp(ui = ui, server = server)

Session Info

─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.4.3 (2025-02-28)
 os       Ubuntu 22.04.5 LTS
 system   x86_64, linux-gnu
 ui       RStudio
 language (EN)
 collate  C.UTF-8
 ctype    C.UTF-8
 tz       Europe/Berlin
 date     2025-05-27
 rstudio  2023.06.1+524 Mountain Hydrangea (server)
 pandoc   2.9.2.1 @ /usr/bin/pandoc
 quarto   1.3.353 @ /usr/lib/rstudio-server/bin/quarto/bin/quarto

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
package * version date (UTC) lib source
bsicons * 0.1.2 2023-11-04 [2] CRAN (R 4.4.3)
bslib * 0.9.0 2025-01-30 [2] CRAN (R 4.4.3)
cachem 1.1.0 2024-05-16 [2] CRAN (R 4.4.3)
cli 3.6.4 2025-02-13 [2] CRAN (R 4.4.3)
devtools 2.4.5 2022-10-11 [2] CRAN (R 4.4.3)
digest 0.6.37 2024-08-19 [2] CRAN (R 4.4.3)
ellipsis 0.3.2 2021-04-29 [2] CRAN (R 4.4.3)
fastmap 1.2.0 2024-05-15 [2] CRAN (R 4.4.3)
fs 1.6.5 2024-10-30 [2] CRAN (R 4.4.3)
glue 1.8.0 2024-09-30 [2] CRAN (R 4.4.3)
htmltools 0.5.8.1 2024-04-04 [2] CRAN (R 4.4.3)
htmlwidgets 1.6.4 2023-12-06 [2] CRAN (R 4.4.3)
httpuv 1.6.15 2024-03-26 [2] CRAN (R 4.4.3)
jquerylib 0.1.4 2021-04-26 [2] CRAN (R 4.4.3)
jsonlite 1.9.1 2025-03-03 [2] CRAN (R 4.4.3)
later 1.4.1 2024-11-27 [2] CRAN (R 4.4.3)
lifecycle 1.0.4 2023-11-07 [2] CRAN (R 4.4.3)
magrittr 2.0.3 2022-03-30 [2] CRAN (R 4.4.3)
memoise 2.0.1 2021-11-26 [2] CRAN (R 4.4.3)
mime 0.12 2021-09-28 [2] CRAN (R 4.4.3)
miniUI 0.1.1.1 2018-05-18 [2] CRAN (R 4.4.3)
pillar 1.10.1 2025-01-07 [2] CRAN (R 4.4.3)
pkgbuild 1.4.6 2025-01-16 [2] CRAN (R 4.4.3)
pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 4.4.3)
pkgload 1.4.0 2024-06-28 [2] CRAN (R 4.4.3)
profvis 0.4.0 2024-09-20 [2] CRAN (R 4.4.3)
promises 1.3.2 2024-11-28 [2] CRAN (R 4.4.3)
purrr 1.0.4 2025-02-05 [2] CRAN (R 4.4.3)
R6 2.6.1 2025-02-15 [2] CRAN (R 4.4.3)
Rcpp 1.0.14 2025-01-12 [2] CRAN (R 4.4.3)
remotes 2.5.0 2024-03-17 [2] CRAN (R 4.4.3)
rlang 1.1.5 2025-01-17 [2] CRAN (R 4.4.3)
rstudioapi 0.17.1 2024-10-22 [2] CRAN (R 4.4.3)
sass 0.4.9 2024-03-15 [2] CRAN (R 4.4.3)
sessioninfo 1.2.3 2025-02-05 [2] CRAN (R 4.4.3)
shiny * 1.10.0 2024-12-14 [2] CRAN (R 4.4.3)
tibble 3.2.1 2023-03-20 [2] CRAN (R 4.4.3)
urlchecker 1.0.1 2021-11-30 [2] CRAN (R 4.4.3)
usethis 3.1.0 2024-11-26 [2] CRAN (R 4.4.3)
vctrs 0.6.5 2023-12-01 [2] CRAN (R 4.4.3)
xtable 1.8-4 2019-04-21 [2] CRAN (R 4.4.3)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the minimal reproducible Shiny app in the issue and isolate the interaction among popover, tooltip, selectizeInput, actionButton, and toggle_popover. Trace the bslib popover and tooltip behavior until the disappearing input is understood; done means the first selectizeInput remains visible after closing and reopening the popover in this scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.