[stable-25.0.x] fix(chat): fix media message sizing and align caption/bubble width to it - #6628
Merged
Merged
Conversation
Fixes a cluster of related Compose layout bugs in single-media chat messages where the bubble's width, height, and caption wrapping didn't track the actual rendered photo/video: - Height cap for extreme aspect ratios: a very tall, narrow image used to render at full natural height, dwarfing the conversation. Height is now capped to a fraction of the screen height, with both width and height scaled together (fittedMediaSize) so the container always matches the image's real aspect ratio — avoiding the mismatched background/border that appeared when only height was capped. - Minimum size floor: media is no longer allowed to shrink below a sensible minimum width/height. - Bubble no longer wider than its media: the caption text, timestamp/read-receipt row, and quoted-reply header now size against the media's actual resolved width (contentMinWidth, threaded down as an absolute Dp rather than a fraction guessed too early) instead of always filling the bubble — closing the gap that used to appear next to narrow (e.g. portrait) images. - Long captions wrap instead of stretching the bubble, but can grow past the media's width up to the bubble's own max width when the media is very thin, so a caption isn't forced to wrap after almost every word. - OverlayMetadataBadge fix: the timestamp pill overlaid on captionless photos was being counted by the Box's "widest child" sizing pass, letting it override the media's own (narrower) width; it's now excluded via matchParentSize(). - Consistent aspect-ratio source: the width fraction used for the caption/quote rows now derives from the same aspect ratio actually used to render the media (falling back to the loaded image's intrinsic ratio when the server doesn't report dimensions), instead of only the server-reported value, which could silently disagree with what was on screen. Assisted-by: Claude Code:claude-sonnet-5 Signed-off-by: Marcel Hibbe <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of PR #6616