Skip to content

fix(agents): edit user messages in place without layout jump - #7007

Merged
l0ng-ai merged 3 commits into
mainfrom
fix/agent-message-inline-edit
Nov 30, 2026
Merged

l0ng-ai merged 3 commits into
mainfrom
fix/agent-message-inline-edit

Conversation

@l0ng-ai

@l0ng-ai l0ng-ai commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Keep editing inside the .userMessage container and preserve .messageHead (timestamp and You label) so clicking Edit no longer shifts the text up or snaps it to a full-width left-aligned textarea.
  • Measure the original bubble width on edit start and apply it via --edit-width (bounded by min(100%, 220px) and the bubble max-width), matching the bubble padding (6px 10px) and line-height: 1.4 so the text origin stays fixed.
  • Restyle the inline editor card (.editCard) to match the Islands composer frame (--bg-elev / --bg-field surface, --focus-ring box-shadow, compact shortcut hint + Cancel/Send footer, right-aligned rollback note below), with CSS Grid auto-sizing up to 280px.
  • Focus with focus({ preventScroll: true }) instead of native autoFocus to prevent scroll jumps, nudging the stream only if the expanded footer extends below the viewport.

Testing

  • npx vitest run src/features/agents/messageEditing.test.tsx (26 passed, including a new test verifying in-place header/container, preserved bubble width, and preventScroll focus)
  • npx tsrs --noEmit

Made with Cursor

@arookieofc-ai arookieofc-ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM — measuring the bubble before swapping in the editor and passing it as --edit-width keeps the width fixed, and focusing with preventScroll plus the mirror-based auto-height avoids the jump. The new test pins the width and the caret position.

@github-actions

Copy link
Copy Markdown

Thanks for the PR. Before review, please update the description (see CONTRIBUTING.md):

  • Fill in How it was verified: the commands you ran and their results. UI changes need before/after screenshots.

This check reruns when you edit the description.

@l0ng-ai
l0ng-ai merged commit 9f1380c into main Nov 30, 2026
2 checks passed
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.

2 participants