Skip to content

Fix: Remove duplicate separators in action menus#8509

Merged
Light2Dark merged 2 commits intomarimo-team:mainfrom
daizutabi:fix-duplicate-separators
Feb 28, 2026
Merged

Fix: Remove duplicate separators in action menus#8509
Light2Dark merged 2 commits intomarimo-team:mainfrom
daizutabi:fix-duplicate-separators

Conversation

@daizutabi
Copy link
Contributor

📝 Summary

This PR fixes an issue where duplicate separators could appear in the cell action dropdown and the cell context menu.

When action items within a group are filtered out (e.g., based on context), the group can become empty. The rendering logic did not account for this, causing separators to be rendered between these empty groups, resulting in visible duplicate separators. This was particularly noticeable in setup cells.

Closes #8492

🔍 Description of Changes

The solution is to filter the list of action groups before rendering. This change removes any groups that are empty after their items have been filtered. By ensuring we only iterate over visible, non-empty groups, we can guarantee that separators are only rendered between actual content.

For CellActionsDropdownInternal in frontend/src/components/editor/cell/cell-actions.tsx:

  const actions = useCellActionButtons({ cell: props, closePopover });

  const visibleActions = actions
    .map((group) => group.filter((action) => !action.redundant))
    .filter((group) => group.length > 0);

The similar approach was applied to CellActionsContextMenu in frontend/src/components/editor/cell/cell-context-menu.tsx.

abc

AI-Assisted Investigation: An AI agent also performed a broad search for the keyword "Separator" across the frontend/src directory to identify any other components that might have a similar bug pattern. No other instances of this issue were found.

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Tests have been added for the changes made.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Pull request title is a good summary of the changes - it will be used in the release notes.

Empty action groups could lead to consecutive `ContextMenuSeparator` components being rendered in the` CellActionsContextMenu`. This resulted in visual glitches with double separators appearing.

To address this, action groups are now pre-filtered. Only non-empty groups (after filtering out hidden or redundant actions) are passed to the renderer, ensuring that separators are correctly placed only between visible action groups.
Empty action groups in the `CellActionsDropdownInternal` component could lead to consecutive `CommandSeparator` components being rendered. This caused visual glitches similar to the context menu.

To fix this, action groups are now pre-filtered. Only non-empty groups (after filtering out redundant actions) are passed to the renderer, ensuring
separators are correctly placed only between visible action groups.
@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Feb 27, 2026 10:35pm

Request Review

Copy link
Contributor

@mscolnick mscolnick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean fix, thank you!

@mscolnick mscolnick added the bug Something isn't working label Feb 27, 2026
@Light2Dark Light2Dark merged commit c2d34aa into marimo-team:main Feb 28, 2026
25 of 26 checks passed
@daizutabi daizutabi deleted the fix-duplicate-separators branch February 28, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate separators in cell actions and context menus

3 participants