Skip to content

Rich text messages: portrait images/videos render inside oversized square media frames #244

Open

Description

@jiz4oh

Bug

Tall portrait media embedded in a Rich Text Message (InstantPage V2) can appear inside an approximately square layout frame with substantial side padding/background, rather than in a tight frame preserving the media's intrinsic aspect ratio.

This differs noticeably from ordinary Telegram photo/video messages.

Steps to reproduce

  1. Send a Rich Text Message containing a portrait .image or .video block (for example, 1080×2400).
  2. Open the message in Telegram for macOS.
  3. Compare its media preview with the same media sent as a regular photo/video.

Expected behavior

A preview preserving the media aspect ratio, subject to reasonable maximum dimensions.

Actual behavior

The outer media frame may become approximately square, with the portrait content letterboxed on both sides.

Image

Root cause analysis

The relevant implementation is in two files:

1. packages/ChatUI/Sources/ChatUI/ChatRichTextRowItem.swift

Rich text messages are rendered using layoutInstantPageV2() with fitToWidth: true and mediaBleed parameters.

2. packages/InstantPageUI/Sources/InstantPageUI/InstantPageV2Layout.swift

Both .image and .video blocks are processed

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions