Skip to content

feat(site): improve edit-message UX with dedicated button and confirmation#23172

Merged
DanielleMaywood merged 1 commit intomainfrom
dm/edit-message-chatbox
Mar 17, 2026
Merged

feat(site): improve edit-message UX with dedicated button and confirmation#23172
DanielleMaywood merged 1 commit intomainfrom
dm/edit-message-chatbox

Conversation

@DanielleMaywood
Copy link
Copy Markdown
Contributor

Summary

Replace click-to-edit on user messages with a dedicated pencil button that appears on hover, so message text can be freely selected and copied.

Changes

  • Edit button on hover: Pencil icon appears in the top-right of user message bubbles, with a tooltip. Replaces the click-anywhere-to-edit behavior that prevented text selection.
  • Prominent editing state: Lightweight warning-colored banner in the chat input, box-shadow outline on both the edited message and the chatbox.
  • Two-step confirmation: First submit shows a warning banner about message deletion, second submit sends the edit. Send button label changes to Save Edit.
  • Visual fading: All messages after the one being edited are faded to 40% opacity with pointer-events disabled.
  • Cancel resets input: Cancelling an edit clears the Lexical editor and restores the pre-edit draft.

Files changed

  • AgentChatInput.tsx — editing banner, confirmation flow, chatbox outline, send button label
  • ConversationTimeline.tsx — pencil edit button, message highlight, after-editing fading
  • AgentDetail.tsx — reset editor on cancel

@DanielleMaywood DanielleMaywood changed the title feat(agents): improve edit-message UX with dedicated button and confirmation feat(site): improve edit-message UX with dedicated button and confirmation Mar 17, 2026
@DanielleMaywood DanielleMaywood force-pushed the dm/edit-message-chatbox branch 9 times, most recently from 5dd9e91 to faf32c8 Compare March 17, 2026 17:13
Comment on lines +562 to 578
//
// However, if the fetched set is missing message IDs the store
// already has (e.g. after an edit truncation), a full replace
// is needed because upsert can only add/update, not remove.
if (chatMessages) {
for (const message of chatMessages) {
store.upsertDurableMessage(message);
const fetchedIDs = new Set(chatMessages.map((m) => m.id));
const storeSnap = store.getSnapshot();
const hasStaleEntries = storeSnap.orderedMessageIDs.some(
(id) => !fetchedIDs.has(id),
);
if (hasStaleEntries) {
store.replaceMessages(chatMessages);
} else {
for (const message of chatMessages) {
store.upsertDurableMessage(message);
}
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Without this change it'd require a page reload to remove the later messages

@DanielleMaywood DanielleMaywood marked this pull request as ready for review March 17, 2026 17:15
…rmation

Replace click-to-edit on user messages with a dedicated pencil
button that appears on hover, so message text can be freely
selected and copied.

Key changes:
- Add hover-visible pencil edit button on user message bubbles
  with tooltip, replacing the click-anywhere-to-edit behavior
- Make the editing banner in AgentChatInput a lightweight border
  separator with warning-colored text instead of a heavy colored
  block
- Add a two-step confirmation flow: first submit shows a warning
  banner, second submit sends the edit
- Send button label changes to 'Save Edit' when editing
- Visually fade (opacity-40) all messages after the one being
  edited to signal they will be deleted
- Highlight the edited message and chatbox with a matching
  box-shadow outline in border-warning color
- Reset the Lexical editor text on edit cancel
- Pass isAfterEditingMessage through StickyUserMessage and
  ChatMessageItem for the fading effect
Comment on lines +920 to +921
// Build a set of message IDs that appear after the message
// currently being edited so they can be visually faded.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice touch

@DanielleMaywood DanielleMaywood merged commit 41d12b8 into main Mar 17, 2026
26 checks passed
@DanielleMaywood DanielleMaywood deleted the dm/edit-message-chatbox branch March 17, 2026 17:39
@github-actions github-actions bot locked and limited conversation to collaborators Mar 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants