posit-dev / posit-dev/py-shiny

bug(ui): All closed panels for `ui.accordion(multiple=True)`'s input value should be `()`, not `None`

Open
#2,113 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.8k
Forks
135
Avg merge
2d 18h
Merged PRs (30d)
21

Description

A possible side-effect is that, if restore_input returns None, now the first panel will be open. (Old behavior was that all panels would be closed.) It's unclear whether restore_input would ever return None or what the expected behavior should be.

When all panels are closed on a multiple=True accordion, currently, the shiny input value is None.

Proposal:

  • When all panels are closed, the input value should be an empty tuple (). (**asking team IRL if this is a good idea)
  • or When all panels are closed, the value stays as None, but you'll need to restore the restore_input logic as it will restore a None value.

Originally posted by @schloerke in https://github.com/posit-dev/py-shiny/issues/2112#issuecomment-3492050667

Requires: https://github.com/rstudio/bslib/issues/1252

Using a shiny input handler (or different input value being sent from browser), we should use an empty tuple, and not None. This will help distinguish between empty and missing value.

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 with the ui.accordion(multiple=True) input handling and the restore_input behavior described in the issue, then review the linked bslib issue 1252. Done means choosing and implementing the agreed behavior for an accordion with all panels closed, with the input represented consistently as either () or None.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.