Setting 'Selected="true"' on a RadzenAccordionItem prevents the item from being collapsed #1572

Closed
opened 2026-01-29 17:55:33 +00:00 by claunia · 1 comment
Owner

Originally created by @DeadM8 on GitHub (Jan 20, 2025).

Describe the bug
When using a RadzenAccordion, if setting Selected="true" on the RadzenAccordionItem, the accordion item is, by default, expanded, as expected. However, when it is clicked to collapse it, it flashes briefly (potentially closing and opening it instantly), but does not collapse. Similarly, setting Selected="false" means that you can't expand the item.

To Reproduce
Steps to reproduce the behavior:
On a razor page:

@rendermode RenderMode.InteractiveServer

<RadzenAccordion>
  <Items>
    <RadzenAccordionItem Text="Can't collapse" Selected="true">
      <RadzenCard>
        <p>Blah blah</p>
      </RadzenCard>
    </RadzenAccordionItem>
    <RadzenAccordionItem Text="Can collapse">
      <RadzenCard>
        <p>Blah blah pt 2</p>
      </RadzenCard>
    </RadzenAccordionItem>
  </Items>
</RadzenAccordion>

Expected behavior
Having Selected="true" should have the accordion item open by default, but still be able to be collapsed by clicking on it.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome
  • Version: 5.7.9

Additional context
Works pre-recent accordion Selected changes (v5.7.4 and before)

Originally created by @DeadM8 on GitHub (Jan 20, 2025). **Describe the bug** When using a RadzenAccordion, if setting `Selected="true"` on the RadzenAccordionItem, the accordion item is, by default, expanded, as expected. However, when it is clicked to collapse it, it flashes briefly (potentially closing and opening it instantly), but does not collapse. Similarly, setting `Selected="false"` means that you can't expand the item. **To Reproduce** Steps to reproduce the behavior: On a razor page: ``` @rendermode RenderMode.InteractiveServer <RadzenAccordion> <Items> <RadzenAccordionItem Text="Can't collapse" Selected="true"> <RadzenCard> <p>Blah blah</p> </RadzenCard> </RadzenAccordionItem> <RadzenAccordionItem Text="Can collapse"> <RadzenCard> <p>Blah blah pt 2</p> </RadzenCard> </RadzenAccordionItem> </Items> </RadzenAccordion> ``` **Expected behavior** Having `Selected="true"` should have the accordion item open by default, but still be able to be collapsed by clicking on it. **Desktop (please complete the following information):** - OS: Windows 10 - Browser: Chrome - Version: 5.7.9 **Additional context** Works pre-recent accordion Selected changes (v5.7.4 and before)
Author
Owner

@enchev commented on GitHub (Jan 20, 2025):

This is expected. Use binding @bind-Selected=@selected to bind to a variable otherwise every state change of the component will restore the initial value declared in the markup.

@enchev commented on GitHub (Jan 20, 2025): This is expected. Use binding @bind-Selected=@selected to bind to a variable otherwise every state change of the component will restore the initial value declared in the markup.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1572