Skip to content

fix: handle zero accordion group id - #5147

Open
bhumikabiyani wants to merge 1 commit into
callstack:mainfrom
bhumikabiyani:fix/accordion-group-zero-id
Open

bhumikabiyani wants to merge 1 commit into
callstack:mainfrom
bhumikabiyani:fix/accordion-group-zero-id

Conversation

@bhumikabiyani

Copy link
Copy Markdown

Motivation

When using List.AccordionGroup as a controlled component, passing expandedId={0} causes the component to ignore the controlled ID and fall back to its internal state because 0 is treated as falsy. As a result, accordion items with id={0} fail to expand when controlled. This pull request ensures that expandedId={0} is respected as a valid controlled identifier.

Related issue

Fixes #5144

Screenshots / Videos

N/A (logic bug fix; behavior is covered by automated regression tests).

Test plan

  1. Render a controlled List.AccordionGroup with expandedId={0} and two accordions (id={0} and id={1}).
  2. Verify that the accordion with id={0} renders as expanded with its children visible.
  3. Verify that the accordion with id={1} renders as collapsed with its children hidden.
  4. Update expandedId dynamically to 1 and back to 0, verifying that the active accordion switches accordingly.

@github-actions

Copy link
Copy Markdown

Found potential problems with the pull request:

  • Screenshot or video evidence is missing. Make sure to include one if it affects the UI.

@bhumikabiyani

Copy link
Copy Markdown
Author

Hi, I noticed the Add contributor label workflow is failing with Invalid keyData while creating the GitHub App token. It looks unrelated to the code changes in this PR. Could a maintainer please check the workflow configuration or app secret?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

List.AccordionGroup ignores a controlled expandedId of 0

1 participant