Skip to content

fix(ui): keep the keyboard open when removing the composer link preview - #3120

Merged
xsahil03x merged 2 commits into
masterfrom
sahil/composer-link-preview-keep-focus
Oct 27, 2026
Merged

xsahil03x merged 2 commits into
masterfrom
sahil/composer-link-preview-keep-focus

Conversation

@xsahil03x

@xsahil03x xsahil03x commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

What

Removing the link preview in the message composer also unfocused the input and closed the keyboard. The other remove buttons in the composer header (edit, quoted reply, attachments) keep focus, and so do Android, iOS, React and React Native when their link preview is dismissed. The "x" now just clears the preview.

Before: after "x" After: after "x"

Verification

  • message_composer_url_enrichment_test.dart: the input keeps focus after the preview is removed (fails without the fix).
  • Android emulator: typed a link, tapped the preview's "x". Before, the keyboard closed. After, it stays open with the cursor in the input.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Removing a link preview from the message composer now leaves the keyboard open and keeps the text input focused. Users can continue editing their message immediately after clearing a preview without needing to tap the composer again or reopen the keyboard. This behavior applies when a URL-generated preview is removed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ed170d38-304d-4bd3-8781-59d306b054d1
Commits

Reviewing files that changed from the base of the PR and between 88bcffa and acb22f4.

Files selected for processing: 1
  • packages/stream_chat_flutter/CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Walkthrough

Removing a link preview clears the OG attachment without unfocusing the composer. A widget test verifies that the preview disappears while the composer input remains focused.

Changes: Composer preview removal

Layer / File(s) Summary
Clear preview while retaining focus
packages/stream_chat_flutter/lib/src/components/message_composer/message_composer_input_header.dart, packages/stream_chat_flutter/test/src/message_input/message_composer_url_enrichment_test.dart, packages/stream_chat_flutter/CHANGELOG.md
The removal callback now clears the OG attachment without unfocusing the composer. The widget test checks that the preview is removed and the input remains focused. The changelog adds an entry about keyboard behavior.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: velikovpetar

Merge Risk: Minimal · up to acb22

The preview is cleared while composer focus is retained, and the change is ready to merge.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: keeping the keyboard open when removing the composer link preview.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.32%. Comparing base (018b487) to head (acb22f4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3120      +/-   ##
==========================================
+ Coverage   80.28%   80.32%   +0.03%     
==========================================
  Files         455      455              
  Lines       29614    29612       -2     
==========================================
+ Hits        23775    23785      +10     
+ Misses       5839     5827      -12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@xsahil03x

Copy link
Copy Markdown
Member Author

Merge note: #3119 changes the line above in the same handler. Whichever merges second keeps clearOGAttachment(dismissed: true) and drops the unfocus().

@xsahil03x
xsahil03x merged commit 81f5c19 into master Oct 27, 2026
41 of 43 checks passed
@xsahil03x
xsahil03x deleted the sahil/composer-link-preview-keep-focus branch October 27, 2026 17:41
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