Skip to content

fix(core): preserve multi-line caret navigation in ChatComposerInput#4284

Open
Lee-Dongwook wants to merge 2 commits into
facebook:mainfrom
Lee-Dongwook:fix/chat-composer-input
Open

fix(core): preserve multi-line caret navigation in ChatComposerInput#4284
Lee-Dongwook wants to merge 2 commits into
facebook:mainfrom
Lee-Dongwook:fix/chat-composer-input

Conversation

@Lee-Dongwook

@Lee-Dongwook Lee-Dongwook commented Jul 24, 2026

Copy link
Copy Markdown

Related Issue

#4282

Summary

Fixes ChatComposerInput message-history navigation so ArrowUp and ArrowDown only recall history when the caret is at the relevant text
boundary.

This preserves the browser’s default vertical caret movement within multi-line drafts.

Changes

  • Recall the previous message with ArrowUp only when the selection is at the start of the draft.
  • Move forward through message history with ArrowDown only when the selection is at the end of the draft.
  • Preserve repeated history navigation when a recalled message is fully selected.
  • Restore the pending draft after navigating past the newest history entry.
  • Add selection-boundary helpers for contenteditable composer input.
  • Add a patch changeset for @astryxdesign/core.

Tests

Added coverage for:

  • ArrowUp recall at the start of a draft
  • Default ArrowUp behavior when the caret is mid-text, including multi-line content
  • Forward/backward history navigation
  • Pending-draft restoration
  • Empty history and hasHistory={false}

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 24, 2026 1:03pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 24, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant