Skip to content

Open message actions menu on poll option long-press#6494

Draft
andremion wants to merge 1 commit into
developfrom
andrerego/and-1220-poll-options-long-press-routes-to-the-toggle-instead-of
Draft

Open message actions menu on poll option long-press#6494
andremion wants to merge 1 commit into
developfrom
andrerego/and-1220-poll-options-long-press-routes-to-the-toggle-instead-of

Conversation

@andremion

@andremion andremion commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Goal

Long-press on a poll option now opens the message actions menu, the same as long-press anywhere else on the message row.

Resolves AND-1220.

Implementation

MessageContainer exposes its long-press handler to descendants through a new LocalMessageOnLongClick CompositionLocal — provided when the message supports actions, null otherwise.

PollOptionVotingRow swaps the toggleable modifier for combinedClickable. The new onLongClick reads LocalMessageOnLongClick.current so TalkBack's double-tap-and-hold opens the message actions menu instead of being intercepted by the toggle. The toggleable's "checked" / "not checked" announce is restored via an explicit toggleableState semantic.

Testing

With TalkBack enabled:

  1. Open a channel containing an open poll with at least one option.
  2. Swipe right until focus lands on a poll option.
  3. Double-tap to vote — the option toggles and TalkBack announces "checked" / "not checked".
  4. Double-tap-and-hold on the same option — the message actions menu opens.
  5. Repeat on a closed poll: options are no longer interactive, and long-press on the message bubble still opens the actions menu.

Without TalkBack:

  1. Tap a poll option — vote toggles as before.
  2. Long-press a poll option — actions menu opens.

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced poll voting interactions with long-press support on poll options.
  • Improvements

    • Improved gesture handling for poll option selection.
    • Better accessibility support for screen readers when voting on polls.

@andremion andremion added the pr:improvement Improvement label Jun 9, 2026
@andremion

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@github-actions

github-actions Bot commented Jun 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.

@coderabbitai

coderabbitai Bot commented Jun 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.

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Review Change Stack

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: ccabd3e1-0c76-4057-ae7f-c56d6204a774

📥 Commits

Reviewing files that changed from the base of the PR and between 9e28643 and 52e4606.

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

Walkthrough

This PR implements long-press gesture forwarding for poll options by introducing a CompositionLocal in MessageContainer that child components can query and invoke. PollOptionVotingRow is updated to use combinedClickable instead of toggleable, enabling independent click and long-press handling while preserving accessibility semantics.

Changes

Long-Press Gesture Forwarding Pipeline

Layer / File(s) Summary
CompositionLocal for Long-Click Forwarding
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/MessageContainer.kt
Introduces LocalMessageOnLongClick CompositionLocal and computes messageOnLongClick callback (enabled only when message row can open actions). Wraps the message row UI with CompositionLocalProvider to expose the callback to descendant components.
Poll Option Long-Press Integration
stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/components/poll/PollOptionVotingRow.kt
Replaces toggleable modifier with combinedClickable to handle click and long-press independently. Long-press is forwarded to LocalMessageOnLongClick.current. Accessibility state is explicitly set via semantics { toggleableState } to preserve TalkBack announcements of vote state.

Sequence Diagram

sequenceDiagram
  participant User
  participant PollOption as PollOptionVotingRow
  participant Handler as combinedClickable
  participant Local as LocalMessageOnLongClick
  participant Actions as MessageRowActions
  
  User->>Handler: Single tap
  Handler->>PollOption: Toggle vote
  Note over PollOption: State updated, vote recorded
  
  User->>Handler: Long-press
  Handler->>Local: Get long-click callback
  Local->>Actions: Invoke messageOnLongClick
  Note over Actions: Open message action menu
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • GetStream/stream-chat-android#6488: Updates MessageContainer's message-row interaction handling so child components can trigger the "open actions" behavior via the same long-press mechanism.
  • GetStream/stream-chat-android#6484: Enhances TalkBack accessibility for the long-press message actions menu, complementing this PR's gesture forwarding with better action-menu announcements.
  • GetStream/stream-chat-android#6425: Refactors MessageContainer's long-press handling for combinedClickable, directly related to the infrastructure this PR builds upon.

Suggested reviewers

  • gpunto
  • VelikovPetar

🐰 A poll option now knows to share its long-press delight,
Via composition locals passed down the tree—a gesture's flight!
Click to vote, long-press to act, accessibility shines through,
With TalkBack announcing the state—a harmony of gesture and view! 🎭✨

🚥 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 clearly and concisely describes the main change: enabling long-press on poll options to open the message actions menu.
Description check ✅ Passed The description includes Goal, Implementation, and Testing sections as per template, but lacks UI changes (screenshots/videos) and incomplete contributor/reviewer checklists.
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 andrerego/and-1220-poll-options-long-press-routes-to-the-toggle-instead-of

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 and usage tips.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-chat-android-client 5.88 MB 5.88 MB 0.00 MB 🟢
stream-chat-android-ui-components 11.11 MB 11.11 MB 0.00 MB 🟢
stream-chat-android-compose 12.53 MB 12.53 MB 0.00 MB 🟢

@sonarqubecloud

sonarqubecloud Bot commented Jun 9, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
78.3% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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

Labels

pr:improvement Improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant