Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Fix compact mode for mini apps#1930

Open
alexstep wants to merge 1 commit intoDrKLO:masterfrom
alexstep:master
Open

Fix compact mode for mini apps#1930
alexstep wants to merge 1 commit intoDrKLO:masterfrom
alexstep:master

Conversation

@alexstep
Copy link

@alexstep alexstep commented Feb 7, 2026

Summary

Fixes compact mode not working for bot mini apps.
When a mini app is configured with mode=compact (via BotFather or
t.me/bot?startapp=...&mode=compact links), the webview sheet
incorrectly expands to full height instead of opening at partial height.

Bug report: https://bugs.telegram.org/c/45743

Root cause

When the server responds to requestWebView / requestAppWebView, the
TL_webViewResultUrl.fullsize field overwrites the local defaultFullsize
value that was correctly set based on the compact flag. Since isFullSize()
uses fullsize ?? defaultFullsize, and fullsize from the server response
is never null, defaultFullsize is effectively ignored.

iOS handles this differently — it determines fullSize from the URL
before the request and passes it directly to AttachmentController,
independent of the server response.

Changes

  • BotWebViewSheet.java: isFullSize() now returns false when
    requestProps.compact is set, giving it priority over the server
    response.
  • BotWebViewAttachedSheet.java: Same fix applied.

Testing

  • Open a mini app with compact mode configured in BotFather via Menu Button
  • Open via direct link: https://t.me/namebot?startapp=p1&mode=compact
  • Verify the sheet opens at partial height (~60% of screen)
  • Verify mode=fullscreen still works correctly (full height, no nav bar)
  • Verify default mode (no mode param) still opens full height

When a mini app is configured with mode=compact, the webview sheet
still expands to full height. This happens because the server response
field `fullsize` in TL_webViewResultUrl overwrites the locally set
`defaultFullsize` flag, ignoring the compact mode entirely.

Add a compact check in isFullSize() for both BotWebViewSheet and
BotWebViewAttachedSheet so that requestProps.compact takes priority
over the server-provided fullsize value.

Bug: https://bugs.telegram.org/c/45743
@tixichko1-cmd
Copy link

@deepdharsha
Copy link

Hello,
could I contribute for this projects

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.

4 participants