Open Edgar-P-yan opened 8 months ago
I fully support this thread. There is a problem at least in the implementation of the "bottom navbar" component. I would really like to see a non-crutch solution
I don’t understand what the Telegram developers relied on when creating the automatic addition of safe zones. This adds a lot of problems, just like specifying the webview height. The only solution to the problems with safe zones is to keep the classic approach, and not create something crooked.
@Edgar-P-yan, you can calculate the difference between the height obtained from viewportHeight and window.innerHeight. This will give you the safe zone value. This works just as poorly as the option that Telegram offers. But I don’t know any other options yet =(
:root {
--safe-area-inset-bottom: calc(100vh - var(--tg-viewport-stable-height, 100vh))
}
Example
div.safemybottomelement {
padding-bottom: calc(1rem + var(--safe-area-inset-bottom));
}
// another example
div.safemybottomelement2 {
padding-bottom: var(--safe-area-inset-bottom);
}
It's my gift, we can probably close the ticket
env(safe-area-inset-bottom)
is always 0
no matter what i try to change in styles or viewport
@kesha-antonov normal, it depend of the situation, sometime you don't have margins on the phone
@kesha-antonov you have to setup this before:
:root {
--safe-area-inset-bottom: calc(100vh - var(--tg-viewport-stable-height, 100vh))
}
in the future you gonna have dvh
env(safe-area-inset-bottom) gives 0
you have to use var(--safe-area-inset-bottom)
you don't read the messages, and solving your problem doesn't seem to be your problem, so I think we can close the ticket
and for information Telegram iOS use Firefox
you have to use var(--safe-area-inset-bottom)
Thanks, I'll try it
To be honest, telegram has made another IE browser. We're suffering.
iPhone 13 pro gives zero safe-area-inset-bottom, but iPhone 13 pro max gives 34px
@kmsheng haha I was thinking the same at one point I give up
Checklist
Description
I'm trying to implement a chat on top of Telegram Mini Apps, and found out that the IPhone bottom white bar is closing some elements that are sticked to the bottom of the screen. For these scenarios we could just add a
padding-bottom: env(safe-area-inset-bottom)
as described here https://webkit.org/blog/7929/designing-websites-for-iphone-x/. It works inside iOS Chrome, iOS Safari, but not inside Telegram Mini Apps.Expected Behavior
What we get in Chrome and Safari:
Actual Behavior
Instead the padding does not work, probably because the
padding-bottom: env(safe-area-inset-bottom)
resolves topadding-bottom: 0 or none
Steps to Reproduce
<div style="height: env(safe-area-inset-bottom); background-color: red"></div>
Environment
Device:
iPhone 14 Pro Max
iOS version:
17.2.1
App version:
10.9.2