Skip to content

fix(conversation): keep message bubble in place during reaction menu overlay - #2257

Open
igotlinux wants to merge 4 commits into
session-foundation:devfrom
igotlinux:fix/message-reaction-overlay-position
Open

igotlinux wants to merge 4 commits into
session-foundation:devfrom
igotlinux:fix/message-reaction-overlay-position

Conversation

@igotlinux

Copy link
Copy Markdown

First time contributor checklist

  • I have tested my contribution on these devices:
  • Android Emulator (Pixel, Android 14 / API 34), playDebug
  • Android Physical Device, playDebug
  • My contribution is fully baked and ready to be merged as is
  • I ensure that all the open issues my contribution fixes are mentioned in the commit message of my first commit using the Fixes #1234 syntax

Description

Previously, when long-pressing a message in the conversation view to open the reaction bar and context menu, ConversationReactionOverlay forcefully shifted the bubble across the screen (snapping it to margin edges), scaled down the bubble snapshot, and ran translation/scaling animations. This displaced the message away from the user's touch and from its position in the chat list.

This PR aligns the overlay interaction with standard modern messaging UX (like WhatsApp / Telegram):

  1. Keeps the message bubble in place: The bubble remains at its exact pixel location (bubbleX, bubbleY) in local coordinates at 1.0f scale, without translation or scale animations.
  2. Dynamic reaction bar placement: Intelligently placed right above the message bubble when space permits, or below if the message is near the top of the screen.
  3. Dynamic context menu placement: Placed below the message bubble, or above the reaction bar if the message is near the bottom of the screen.
  4. Preserves timestamp: Keeps the timestamp visible adjacent to the bubble without shifting or distorting the bubble position.

Testing:

  • Verified in Android Studio: compilePlayDebugKotlin, compilePlayDebugJavaWithJavac, and testPlayDebugUnitTest all pass.
  • Tested long-pressing top, middle, and bottom messages; verified the message bubble stays anchored in place while the reaction bar and context menu appear around it.

@mpretty-cyro mpretty-cyro left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for your contribution, I did some quick testing and it looks like there are a few bugs with the current code:

  • An outgoing message lands 8dp to the right of where it was (screenshot 1)
  • In RTL languages, the message moves sideways by the width of its timestamp (incoming messages can end up at or past the right edge) (screenshot 2 - with force RTL enabled)
  • The reaction bar can be covered by the context menu (screenshot 3)
  • When the menu closes the message slides in the wrong direction before snapping back to the original position (video 1)

screenshot 1
Screenshot 2026-11-18 at 6 48 34 am

screenshot 2
Screenshot 2026-11-18 at 7 04 00 am

screenshot 3
Screenshot 2026-11-18 at 7 02 55 am

video 1
https://github.com/user-attachments/assets/d5724c24-78e6-4676-8c6e-04697ec06b54

@igotlinux

Copy link
Copy Markdown
Author

Thanks for testing and catching those @mpretty-cyro! Fixed all 4 issues in the latest commit:

  • Accounted for both leftMargin and rightMargin (marginHorizontal) on conversationTimestamp so outgoing bubbles no longer land 8dp off.
  • Switched bubble/timestamp horizontal offset logic to use isMessageOnLeft (isOutgoing xor isLtr) so RTL incoming/outgoing messages stay anchored at their exact X position.
  • Clamped reaction bar bounds, allowed side-by-side placement in landscape regardless of vertical fit, and updated calculateMenuY so the context menu flips cleanly without covering the reaction bar.
  • Removed the X/Y/SCALE animators in newHideAnimators() that were sliding the bubble away on close before snapping back.

Verified with compilePlayDebugKotlin and testPlayDebugUnitTest.

@igotlinux

Copy link
Copy Markdown
Author

also noticed another bug when the keyboard is open and you long press the last sent/received message. hideKeyboard() was closing the keyboard after we already grabbed bubbleY, so the recyclerview would resize/drop down while the overlay snapshot stayed up at the old spot (causing a duplicate bubble sticking out underneath).

i kept the keyboard as-is when long pressing and added WindowInsetsCompat.Type.ime() to the overlay insets so the reaction bar and context menu stay above the keyboard instead. let me know if you want screenshots of what was happening before

@igotlinux

Copy link
Copy Markdown
Author

also clipped the overlay message snapshot to the recyclerview's visible bounds. before this, if a tall message was partially scrolled under the top app bar or behind the input bar, the unclipped bitmap would draw over them. now it stays strictly within the chat list area between the top bar and input bar/keyboard

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