Skip to content

compose: Show poll option text in full and align option layout with the design#6559

Merged
andremion merged 3 commits into
developfrom
andrerego/and-1274-compose-poll-option-text-truncated
Jul 9, 2026
Merged

compose: Show poll option text in full and align option layout with the design#6559
andremion merged 3 commits into
developfrom
andrerego/and-1274-compose-poll-option-text-truncated

Conversation

@andremion

@andremion andremion commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Goal

In the Compose SDK, long poll option text in the message bubble was truncated to 2 lines with an ellipsis. On iOS the full text is shown, so this was a parity gap. This change shows the full option text and, while on the same option row, aligns the layout with the design spec.

Resolves AND-1274

Implementation

  • Remove the maxLines = 2 / TextOverflow.Ellipsis on the option text so it renders in full.
  • Top-align the option row content (radio, voter avatars, vote count) so they sit on the first line of a wrapped option, matching the design's items-start. A LineHeightStyle with Trim.None keeps the gap from the text to the progress bar consistent for one-line and multi-line options.
  • Give each option a rounded 12dp tap frame with a Material ripple (clip + combinedClickable(indication = ripple())), replacing the flat state overlay that came from the fallback indication. An 8dp padding makes the ripple wrap the whole option (radio, text, votes, progress bar).
  • Match the design spacing: options are grouped with an 8dp horizontal inset and a 2dp gap between them, in both the message bubble (PollMessageContent) and the more-options sheet (PollMoreOptionsDialog).
  • Reserve the voter-avatar height (avatarSize + AvatarStackBorderSize) for the votes area on non-anonymous polls, so an option with a voter avatar keeps the same height as one without.
  • Keep a consistent 8dp gap between the option text and the vote count even when an option has no avatars.

🎨 UI Changes

Visual changes on the poll message and the more-options sheet:

  • Long option text now wraps and shows in full instead of being cut to 2 lines.
  • Tapping an option shows a rounded ripple instead of a flat grey background.
  • Tighter, spec-aligned spacing between options.
  • Options keep the same height whether or not they have a voter avatar.

Before and after are captured in the updated Paparazzi snapshots in this PR (PollMessageContentTest, PollMoreOptionsDialogTest, MessageListTest).

Testing

  1. Open a channel and send a poll with at least one option whose text is long enough to wrap past 2 lines.
  2. Confirm the long option shows in full (no ellipsis), matching iOS.
  3. Tap an option and confirm the press shows a rounded ripple, not a flat grey fill.
  4. Vote on one option and confirm its row does not become taller than the others (the voter avatar appears without changing the option height).
  5. Open the more-options sheet ("See all options") and confirm the option spacing matches the message bubble.

Summary by CodeRabbit

  • New Features

    • Improved poll option and avatar stack layouts for a cleaner, more consistent chat experience.
    • Poll options now maintain steadier spacing and alignment, including better handling of longer option text.
  • Bug Fixes

    • Fixed inconsistent poll row heights so options display more uniformly.
    • Improved poll interaction behavior and vote count presentation for clearer, more reliable UI feedback.

andremion added 3 commits July 9, 2026 10:00
Remove the 2-line cap on poll option text so long options render in full,
matching iOS. Top-align the option row content (radio, voter avatars, vote
count) to the first line and keep a consistent gap from the option text to
the progress bar regardless of how many lines the option wraps to.
Give each poll option a rounded, 8dp-padded tap frame with a Material
ripple, replacing the flat state overlay that came from the fallback
indication. Tighten the spacing between options and align the options
group to the design's 8dp inset with a 2dp gap, in both the message
bubble and the more-options sheet.

Reserve the voter-avatar height for the votes area on non-anonymous
polls so an option with a voter avatar keeps the same height as one
without.
Move the 8dp gap between the option text and the votes area onto the row
so it applies whether or not the option has voter avatars. Previously the
gap only came from the avatar padding, so an option without avatars had
its vote count flush against the text.
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

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, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@andremion andremion added the pr:bug Bug fix label Jul 9, 2026
@andremion

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

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.

@andremion andremion added pr:improvement Improvement and removed pr:bug Bug fix labels Jul 9, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR refines poll-related Compose UI. It introduces a shared AvatarStackBorderSize constant, simplifies spacing logic in PollMessageContent and PollMoreOptionsDialog, reworks PollOptionVotingRow interaction handling and layout (ripple-based clickable, height-consistent vote display, text styling), and adds new snapshot tests.

Changes

Poll UI Spacing and Interaction Refinements

Layer / File(s) Summary
Avatar stack border constant
.../avatar/AvatarStack.kt
Adds internal val AvatarStackBorderSize = 2.dp and replaces the local borderSize variable in UserAvatarStack's modifier chain with this constant.
Poll message content spacing refactor
.../messages/PollMessageContent.kt
Replaces per-option PaddingValues padding logic with Arrangement.spacedBy on containing Columns; adds a modifier parameter to PollButtons applied to its root Column.
Poll more options dialog spacing
.../poll/PollMoreOptionsDialog.kt
Reduces list verticalArrangement spacing from spacingXs to spacing3xs and removes explicit padding modifier passed to PollOptionVotingRow.
Poll option voting row interaction and layout rework
.../poll/PollOptionVotingRow.kt
Adds a remembered MutableInteractionSource wired into combinedClickable with ripple(); reworks container padding/spacing, RadioCheck semantics, text styling via LineHeightStyle, and computes avatarSize/showsAvatars/votesMinHeight for a height-consistent vote count and avatar stack area.
Poll message content snapshot tests
.../messages/PollMessageContentTest.kt
Switches fixtures to imported PreviewMessageData/PreviewPollData and adds snapshot tests for long option text and mixed vote states.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested labels: pr:improvement

Suggested reviewers: gpunto

Poem

A border of two dips, precise and true,
Options now breathe with spacing anew,
Ripples replace the old toggle's beat,
Votes stand tall on consistent feet,
This bunny hops through snapshots bright—
Poll rows polished, just right! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly describes the main UI change: showing full poll option text and aligning the option layout to the design.
Description check ✅ Passed The description includes the required Goal, Implementation, UI Changes, and Testing sections with clear details; only optional screenshots/checklists/GIF are missing.
✨ 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 andrerego/and-1274-compose-poll-option-text-truncated

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/PollMessageContent.kt (1)

296-304: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider placing modifier as the first parameter in PollButtons.

Compose convention recommends the modifier parameter be the first parameter (or at least the first with a default) for consistency across the codebase. The public PollMessageContent already follows this convention. Since PollButtons is called with named arguments, moving modifier to the first position is safe.

♻️ Optional refactor
 private fun PollButtons(
+    modifier: Modifier = Modifier,
     poll: Poll,
     style: PollStyle,
     selectPoll: (Message, Poll, PollSelectionType) -> Unit,
     message: Message,
     showDialog: MutableState<Boolean>,
     showAddAnswerDialog: MutableState<Boolean>,
     isMine: Boolean,
     onClosePoll: (String) -> Unit,
-    modifier: Modifier = Modifier,
 ) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/PollMessageContent.kt`
around lines 296 - 304, Move the `modifier` parameter to the first position in
`PollButtons` to match Compose conventions and the existing `PollMessageContent`
signature. Update the `PollButtons` function declaration so `modifier` is the
leading default parameter, and keep its call sites working with named arguments
without changing behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/PollMessageContent.kt`:
- Around line 296-304: Move the `modifier` parameter to the first position in
`PollButtons` to match Compose conventions and the existing `PollMessageContent`
signature. Update the `PollButtons` function declaration so `modifier` is the
leading default parameter, and keep its call sites working with named arguments
without changing behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fbc2a034-2072-4ec1-b1a9-b36cfde6943a

📥 Commits

Reviewing files that changed from the base of the PR and between 6c83f2f and 1af97b7.

⛔ Files ignored due to path filters (7)
  • stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_PollMessageContentTest_poll_content.png is excluded by !**/*.png
  • stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_PollMessageContentTest_poll_content_with_long_option_text.png is excluded by !**/*.png
  • stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.messages_PollMessageContentTest_poll_content_with_mixed_vote_states.png is excluded by !**/*.png
  • stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.poll_PollMoreOptionsDialogTest_more_options.png is excluded by !**/*.png
  • stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.components.poll_PollMoreOptionsDialogTest_more_options_in_dark_mode.png is excluded by !**/*.png
  • stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.messages_MessageListTest_loaded_messages.png is excluded by !**/*.png
  • stream-chat-android-compose/src/test/snapshots/images/io.getstream.chat.android.compose.ui.messages_MessageListTest_loaded_messages_in_dark_mode.png is excluded by !**/*.png
📒 Files selected for processing (5)
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/avatar/AvatarStack.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/messages/PollMessageContent.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollMoreOptionsDialog.kt
  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollOptionVotingRow.kt
  • stream-chat-android-compose/src/test/kotlin/io/getstream/chat/android/compose/ui/components/messages/PollMessageContentTest.kt

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.94 MB 5.94 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.20 MB 11.20 MB 0.00 MB 🟢
stream-chat-android-compose 12.68 MB 12.68 MB 0.00 MB 🟢

@andremion andremion marked this pull request as ready for review July 9, 2026 09:39
@andremion andremion requested a review from a team as a code owner July 9, 2026 09:39
@andremion andremion enabled auto-merge (squash) July 9, 2026 09:39
@andremion andremion merged commit 4067096 into develop Jul 9, 2026
22 of 24 checks passed
@andremion andremion deleted the andrerego/and-1274-compose-poll-option-text-truncated branch July 9, 2026 10:19
@stream-public-bot stream-public-bot added the released Included in a release label Jul 13, 2026
@stream-public-bot

Copy link
Copy Markdown
Contributor

🚀 Available in v7.6.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