Skip to content

Conversation

Sagar0-0
Copy link
Contributor

@Sagar0-0 Sagar0-0 commented Jun 10, 2025

🎯 Goal

Introduce a mechanism to programmatically request focus on the message input field when a MessageAction is triggered, improving UX in actions like replying, editing, or thread replies.

🛠 Implementation details

  • Introduced a focusRequestFlow in MessageComposerViewModel to emit one-shot focus events.
  • Collected this flow in the default input = MessageComposer composable using LaunchedEffect to request focus and show the keyboard.
  • Used FocusRequester and LocalSoftwareKeyboardController to programmatically focus and open the keyboard.
  • Applied the FocusRequester to the message input using a Modifier.

This can be further improved by passing a focusRequester as a parameter in the input (along with the state), but that would require changes in many places, which is why I avoided it and added the mechanism only to the default input.

Let me know if there are better places to add this in the Compose code. I believe it's better to provide an option to pass/access for Modifier or FocusRequester for Message Input.

🎨 UI Changes

Add relevant videos

Before After
Record_2025-06-10-19-33-08.mp4
Record_2025-06-10-19-24-27.mp4

🧪 Testing

  • Manually verified that when a MessageAction like Reply, Edit, or ThreadReply is triggered, the message input gains focus and the keyboard opens.
  • Tested in both default and custom input configurations.

☑️Contributor Checklist

General

  • I have signed the Stream CLA (required)
  • Assigned a person / code owner group (required)
  • Thread with the PR link started in a respective Slack channel (#android-chat-core or #android-chat-ui) (required)
  • PR is linked to the GitHub issue it resolves

Code & documentation

  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Comparison screenshots added for visual changes
  • Affected documentation updated (KDocs, docusaurus, tutorial)

☑️Reviewer Checklist

  • UI Components sample runs & works
  • Compose sample runs & works
  • UI Changes correct (before & after images)
  • Bugs validated (bugfixes)
  • New feature tested and works
  • Release notes and docs clearly describe changes
  • All code we touched has new or updated KDocs

🎉 GIF

Please provide a suitable gif that describes your work on this pull request

@Sagar0-0 Sagar0-0 requested a review from a team as a code owner June 10, 2025 13:54
Copy link
Contributor

github-actions bot commented Oct 6, 2025

This pull request has been automatically marked as stale because it has been inactive for 14 days. It will be closed in 7 days if no further activity occurs.

@github-actions github-actions bot added the Stale label Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant