home: Fix compose box not visible on focus in Firefox Android.

Fixes #34010

From version 132, Firefox now defaults to not resize the viewport
content but only the visual viewport. While this works well in
Chrome Android, it creates a buggy experience in Firefox Android
where the compose box is hidden under keyboard.

To fix it, we rollback to resizing content when keyboard is shown
on Firefox Android.
This commit is contained in:
Aman Agrawal
2025-03-20 08:02:58 +05:30
committed by Tim Abbott
parent 299daa35bd
commit ec7252138c
2 changed files with 8 additions and 1 deletions

View File

@@ -7,7 +7,12 @@
{% set PAGE_DESCRIPTION = _("Browse the publicly accessible channels in {org_name} without logging in.").format(org_name=realm_name) %}
{% block meta_viewport %}
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- From version 132, Firefox now defaults to not resize the viewport
content but only the visual viewport. While this works well in
Chrome Android, it creates a buggy experience in Firefox Android
where the compose box is hidden under keyboard. To fix it, we rollback
to resizing content when keyboard is shown on Firefox Android. -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no {% if is_firefox_android %}, interactive-widget=resizes-content{% endif %}" />
{% endblock %}
{% block customhead %}

View File

@@ -244,6 +244,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
csp_nonce = secrets.token_hex(24)
user_permission_info = get_user_permission_info(user_profile)
is_firefox_android = "Firefox" in client_user_agent and "Android" in client_user_agent
response = render(
request,
@@ -254,6 +255,7 @@ def home_real(request: HttpRequest) -> HttpResponse:
"csp_nonce": csp_nonce,
"color_scheme": user_permission_info.color_scheme,
"enable_gravatar": settings.ENABLE_GRAVATAR,
"is_firefox_android": is_firefox_android,
"s3_avatar_public_url_prefix": settings.S3_AVATAR_PUBLIC_URL_PREFIX
if settings.LOCAL_UPLOADS_DIR is None
else "",