Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 20, 2025

Description

This PR fixes the ContextMenu positioning issue when editing user messages. The menu now appears consistently close to the input area in both edit mode and the bottom text area.

Problem

When users edit a message and type '@' to mention files or other context, the ContextMenu appears misplaced - far from the editing area. This was caused by conditional positioning logic that applied different CSS classes based on whether the component was in edit mode.

Solution

  • Removed conditional left positioning (left-6 vs left-0) based on isEditMode
  • Removed conditional bottom margin (-mb-3 vs mb-2) based on isEditMode
  • The ContextMenu now uses consistent positioning (left-0 and mb-2) in both modes

Testing

  • ✅ All existing tests pass (277 tests in chat components)
  • ✅ Type checking passes
  • ✅ Linting passes
  • ✅ Manual testing confirms the ContextMenu appears correctly in both edit mode and bottom text area

Screenshots

Before: ContextMenu was misplaced when editing messages
After: ContextMenu appears consistently close to the input area

Fixes #8190


Important

Fixes ContextMenu positioning in ChatTextArea.tsx by applying consistent CSS classes for both edit and non-edit modes.

  • Behavior:
    • Fixes ContextMenu positioning in ChatTextArea.tsx by removing conditional CSS classes left-6 and -mb-3.
    • Applies consistent positioning with left-0 and mb-2 in both edit and non-edit modes.
  • Testing:
    • All existing tests pass (277 tests in chat components).
    • Type checking and linting pass.
    • Manual testing confirms correct ContextMenu appearance in both modes.

This description was created by Ellipsis for b80dc50. You can customize this summary. It will automatically update as commits are pushed.

- Remove conditional left positioning (left-6 vs left-0) based on isEditMode
- Remove conditional bottom margin (-mb-3 vs mb-2) based on isEditMode
- Ensures ContextMenu appears consistently close to the input area in both modes
- Fixes issue where ContextMenu was misplaced when editing messages

Fixes #8190
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 20, 2025 02:30
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Sep 20, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

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

Reviewing my own code is like debugging in a mirror - everything looks backwards but somehow still broken.

"absolute",
"bottom-full",
isEditMode ? "left-6" : "left-0",
"left-0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Consider adding a comment here explaining why we use consistent positioning instead of conditional logic based on isEditMode. This would help future maintainers understand the design decision and prevent regression.

Example:

"right-0",
"z-[1000]",
isEditMode ? "-mb-3" : "mb-2",
"mb-2",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

While this change correctly fixes the positioning issue, please verify that the ContextMenu still appears correctly in all usage scenarios:

  • Normal message input at bottom
  • Edit mode for existing messages
  • Different viewport sizes
  • With and without images attached

Consider adding visual regression tests or at least screenshots to the PR description showing the before/after comparison.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 20, 2025
@NaccOll
Copy link
Contributor

NaccOll commented Sep 20, 2025

It has been tested and works as expected. The parent container style changes make it unnecessary to process the ContextMenu in edit mode.

image

@hannesrudolph hannesrudolph moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Sep 23, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Sep 23, 2025
@daniel-lxs daniel-lxs closed this Oct 23, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Oct 23, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Oct 23, 2025
@NaccOll
Copy link
Contributor

NaccOll commented Oct 24, 2025

@daniel-lxs Is there something wrong with this PR?

Mode assertions were originally intended to fix misalignment, but due to UI changes to the outer container (modified by Brunobergher), they are now the culprit for misalignment in the inline editor's ContextMenu.

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

Labels

bug Something isn't working PR - Needs Preliminary Review size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[BUG] ContextMenu is misplaced when editing a message

5 participants