You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(editor): allow standalone accordion deletion and add AccordionGroup popover menu (#4633)
Fixes the accordion deletion logic in the fern-dashboard visual editor.
## Changes Made
This PR fixes two issues with accordion components in the visual editor:
1. **Standalone accordions can now be deleted**: Previously, standalone `Accordion` components (those not within an `AccordionGroup`) could not be deleted because the deletion logic incorrectly treated them as if they were the last accordion in a group.
2. **AccordionGroup now has a popover menu with delete functionality**: Added an `EditorComponentPopoverButton` and `EditorComponentPopoverProvider` to the `AccordionGroup` component, allowing users to delete the entire group.
## Implementation Details
- Added an `isInGroup` boolean prop to `AccordionItem` to distinguish between standalone accordions and those within an AccordionGroup
- Modified the `disableDelete` logic from `accordions.length === 1` to `isInGroup && accordions.length === 1`, so deletion is only prevented for the last accordion within a group
- Wrapped `AccordionGroup` content with `EditorComponentPopoverProvider` (using empty attributes object since no editable properties are needed)
- Added popover button to AccordionGroup with `z-10` to ensure visibility above accordion content
## What was the motivation & context behind this PR?
User reported that standalone accordions could not be deleted, and AccordionGroup components had no way to be deleted at all. The root cause was that the deletion prevention logic (`disableDelete={accordions.length === 1}`) was applied to all accordions regardless of context, including standalone ones which always had an array length of 1.
## How has this PR been tested?
- ✅ Code compiled successfully
- ✅ Passed all lint checks (`pnpm lint:biome`, `pnpm lint:style`, `pnpm format:yaml:check`)
- ⚠️ **Not tested in running application** - requires manual verification in the dashboard editor
## Human Review Checklist
Please verify the following when reviewing:
- [ ] Standalone `Accordion` components can be deleted in the visual editor
- [ ] The last accordion within an `AccordionGroup` still cannot be deleted (protection maintained)
- [ ] `AccordionGroup` now has a visible popover menu with a delete button
- [ ] No z-index or visual layering issues with the new popover button
- [ ] Empty `attributes={{}}` is appropriate for AccordionGroup (no editable properties needed besides delete)
---
**Link to Devin run:** https://app.devin.ai/sessions/e4e7ea824cca4b75ab65a4f217e55334
**Requested by:** Sarah Bawabe (@sbawabe)
0 commit comments