rstudio / rstudio/bslib

Accordion reports `NULL` value during panel switch when `multiple = TRUE`

Open
#660 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

In the following app code, which throttles the accordion's reported value, you can see that when one panel is active and you activate another panel, the accordion input value briefly reports a NULL state.

Reprex code
library(shiny)
library(bslib)

ui <- page_fluid(
  layout_columns(
    accordion(
      id = "accordion",
      multiple = FALSE,
      accordion_panel("One", "First panel"),
      accordion_panel("Two", "Second panel"),
    ),
    verbatimTextOutput("debug")
  )
)

server <- function(input, output) {
  accordion_value <- throttle(reactive(input$accordion), 1000)
  output$debug <- renderPrint(accordion_value())
}

shinyApp(ui, server)

https://github.com/rstudio/bslib/assets/5420529/ed70dbaa-fdf0-41cc-9ddd-2d3061e8742f

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 provided Shiny reprex with bslib's accordion() and its throttled reactive value, then trace the accordion input updates during a panel switch. Done means switching panels with multiple selection enabled no longer produces a transient NULL value in the reported accordion input.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.