Skip to content

🤖 refactor: migrate SectionHeader actions menu to PositionedMenu#3111

Open
jaaydenh wants to merge 5 commits intomainfrom
context-menu-gc82
Open

🤖 refactor: migrate SectionHeader actions menu to PositionedMenu#3111
jaaydenh wants to merge 5 commits intomainfrom
context-menu-gc82

Conversation

@jaaydenh
Copy link
Copy Markdown
Contributor

@jaaydenh jaaydenh commented Apr 2, 2026

Summary

Migrates the section kebab (⋮) menu from a custom absolute-positioned dropdown to the shared PositionedMenu + useContextMenuPosition primitives, so the menu stays fully visible when opened near the viewport bottom.

Background

The section actions menu rendered as an absolute top-full right-0 panel with manual outside-click handling. When a section was near the bottom of the window, the menu clipped offscreen — and expanding "Change color" made it worse. The codebase already has shared positioning primitives (PositionedMenu + useContextMenuPosition) used in ProjectSidebar that handle viewport collision via Radix Popover + Floating UI.

Implementation

  • Replaced the custom absolute dropdown, isActionsMenuOpen state, actionsMenuRef, and document.addEventListener("mousedown") outside-click handler with useContextMenuPosition() + <PositionedMenu>.
  • Preserved all existing actions: Change color (inline picker), Rename, Delete — no behavioral changes.
  • Color picker reset: showColorPicker resets to false on menu close via the onOpenChange callback.
  • Tests: Added PositionedMenu/PositionedMenuItem mocks (same pattern as ProjectSidebar tests) and a new "SectionHeader actions menu" test suite covering: menu opens, color picker expands, rename enters edit mode, delete calls handler. Existing auto-create editing tests preserved.

Risks

Low — this is a container-level swap using primitives already proven in ProjectSidebar. Menu content and action handlers are unchanged.


Generated with mux • Model: anthropic:claude-opus-4-6 • Thinking: xhigh • Cost: $4.42

@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Apr 2, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b630e9527

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Apr 2, 2026

@codex review

Added toggle behavior: clicking the kebab button now closes the menu if it's already open, instead of always repositioning. This restores the pre-migration UX.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 361f3d45dc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Apr 2, 2026

@codex review

Fixed: added setShowColorPicker(false) in the toggle-close branch so reopening the menu always shows top-level actions.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Apr 3, 2026

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cee5767a03

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@jaaydenh
Copy link
Copy Markdown
Contributor Author

jaaydenh commented Apr 3, 2026

@codex review

@jaaydenh jaaydenh self-assigned this Apr 3, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 621a975eb0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +201 to +207
onClick={(e: React.MouseEvent) => {
if (sectionMenu.isOpen) {
setShowColorPicker(false);
sectionMenu.close();
return;
}
sectionMenu.onContextMenu(e);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep kebab click from reopening an already-open menu

When the section actions menu is open, clicking the kebab can close-and-immediately-reopen the popover instead of toggling it off. PositionedMenu (Radix Popover) dismisses on outside pointer interaction before the button onClick runs, so by the time this handler executes sectionMenu.isOpen may already be false and the fallback path calls sectionMenu.onContextMenu(e), reopening at the click position. This makes the trigger unreliable for closing the menu and regresses the previous explicit toggle behavior.

Useful? React with 👍 / 👎.

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.

1 participant