Skip to content

Expand message long-press hit area to entire cell#6405

Merged
aleksandar-apostolov merged 4 commits intodevelopfrom
fix/ds-031-message-cell-tap-area
May 4, 2026
Merged

Expand message long-press hit area to entire cell#6405
aleksandar-apostolov merged 4 commits intodevelopfrom
fix/ds-031-message-cell-tap-area

Conversation

@andremion
Copy link
Copy Markdown
Contributor

@andremion andremion commented Apr 30, 2026

Goal

Long-press to open the message actions menu now targets the entire message cell, not the bubble alone. Aligns the long-press surface with the existing swipe-to-reply surface (already cell-wide), gives short one or two character messages an adequate gesture target, and matches the dominant convention on WhatsApp / iMessage.

Implementation

Three commits, intentionally separate so the structural change is reviewable in isolation:

  1. Expand message long-press hit area to entire cell — moves the Modifier.combinedClickable from the inner content row (wrapContentWidth) to the outer container (fillMaxWidth), so the click and long-click handlers fire anywhere across the row. Switches indication = null to indication = ripple() so the gesture target is visible to the user. Reaction bar and actions menu remain anchored to the bubble; only the gesture surface widens.
  2. Extract message click predicates into named locals — replaces the inline boolean expressions inside the click and long-click lambdas with canOpenThread and canOpenActions, so the gesture handlers read as intent.
  3. Collapse message item Box+Row wrapper into a single Row — the outer Box(fillMaxWidth, contentAlignment) was only providing edge alignment, which a Row achieves directly via horizontalArrangement. Drops the redundant Stream_MessageItem test tag (zero references outside this file) and keeps Stream_MessageCell on the merged Row, where it accurately labels the cell that the gesture surface lives on.

API surface

No public API changes. apiDump produces no diff.

🎨 UI Changes

Before After
Screen_recording_20260430_144412.webm
Screen_recording_20260430_140334.webm

Testing

Run the Compose sample app on a device and open any channel.

  1. Hit-area expansion. Long-press in the empty space to the side of a short message bubble (e.g. a one-character "k"). Expected: the message actions menu opens — previously only long-pressing on the bubble itself worked.
  2. Ripple feedback. Tap any message anywhere on the row. Expected: a ripple emanates from the touch point across the full row width.
  3. Bubble-anchored UI unchanged. Open the message actions menu and the reactions picker. Expected: both remain visually anchored to the bubble, not the cell — the gesture target widened, not the visual anchor.
  4. Swipe-to-reply. Horizontal swipe on the row. Expected: works as before — SwipeToReply is still the parent of the merged Row.
  5. Thread-start tap. Tap on a message that started a thread, from outside that thread. Expected: opens the thread, exactly as before.
  6. Deleted / uploading messages. Long-press a deleted message or one that is mid-upload. Expected: no actions menu appears (gated by canOpenActions).
  7. Outgoing vs incoming alignment. Scroll through a mix of own and other-user messages. Expected: outgoing messages remain right-aligned, incoming left-aligned, with the avatar on the correct side.

Summary by CodeRabbit

  • Style
    • Enhanced message interactions with ripple effect feedback, improving visual response when tapping messages.
    • Improved message layout structure for better rendering consistency.

@andremion andremion added the pr:improvement Improvement label Apr 30, 2026
@andremion
Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 682de737-63e1-4dce-b22a-9a4577acd854

📥 Commits

Reviewing files that changed from the base of the PR and between c823b08 and 2a695fe.

📒 Files selected for processing (1)
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageContainer.kt

Walkthrough

The message container's click behavior is now controlled by computed flags (canOpenThread, canOpenActions) instead of inline checks. The layout is refactored from nested Box/Row to a single Row-based cell, click indication uses Material3 ripple(), and horizontal alignment is driven by Row's horizontalArrangement property.

Changes

Cohort / File(s) Summary
Message Container Refactoring
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageContainer.kt
Consolidates click/long-click control into computed flags, introduces Material3 ripple indication, restructures layout from nested Box/Row hierarchy to single Row-based cell, updates test tag to Stream_MessageCell, and uses horizontalArrangement for alignment.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A message cell hops into place,
No more nested boxes cluttering space,
Ripples shine with Material three,
Computed flags set interactions free,
Layout's cleaner, logic's neater—hop hooray! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: expanding the message long-press hit area to the entire cell.
Description check ✅ Passed The description covers all required sections: Goal, Implementation, UI Changes with before/after videos, Testing, and includes the Contributor Checklist.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ds-031-message-cell-tap-area

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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.82 MB 5.82 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.02 MB 11.02 MB 0.00 MB 🟢
stream-chat-android-compose 12.37 MB 12.37 MB 0.00 MB 🟢

@andremion andremion marked this pull request as ready for review April 30, 2026 15:03
@andremion andremion requested a review from a team as a code owner April 30, 2026 15:03
andremion added 4 commits May 4, 2026 09:21
Move the click modifier from the inner content Row (wrap-content) to the outer Box (full-width) so long-press can be triggered anywhere across the row, not only on the avatar+bubble area. Aligns the long-press surface with the swipe surface and matches iOS behaviour.

Adds a ripple indication so the gesture target is visible to the user.
Replace inline boolean expressions inside the click and long-click lambdas with `canOpenThread` and `canOpenActions`, so the gesture handlers read as intent rather than condition bookkeeping.
Replace the outer `Box(fillMaxWidth, contentAlignment)` + inner `Row(wrapContentWidth)` pair with a single `Row(fillMaxWidth, horizontalArrangement)`. The Box was only providing edge alignment, which a Row achieves directly via `horizontalArrangement` mapped from `MessageAlignment`.

Drops the now-redundant `Stream_MessageItem` test tag (zero references outside this file) and keeps `Stream_MessageCell` on the merged Row, where it accurately labels the message cell that the gesture surface lives on.
@andremion andremion force-pushed the fix/ds-031-message-cell-tap-area branch from 2a695fe to f645c2b Compare May 4, 2026 08:21
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 4, 2026

@aleksandar-apostolov aleksandar-apostolov merged commit 84b9b96 into develop May 4, 2026
16 checks passed
@aleksandar-apostolov aleksandar-apostolov deleted the fix/ds-031-message-cell-tap-area branch May 4, 2026 13:13
@stream-public-bot stream-public-bot added the released Included in a release label May 5, 2026
@stream-public-bot
Copy link
Copy Markdown
Contributor

🚀 Available in v7.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:improvement Improvement released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants