Open Bug 2057232 Opened 3 months ago Updated 2 days ago

Firefox Android regression with env(safe-area-inset-bottom) affecting dock/bottom UI

Categories

(GeckoView :: General, defect)

Firefox 150
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: github, Assigned: m_kato, NeedInfo)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file, 1 external file, 1 obsolete file)

Firefox for Android

Steps to reproduce:

  1. Open Firefox for Android 150 or newer.
  2. Visit a website that uses env(safe-area-inset-bottom) for layout.
  3. Set the address bar to the top in Firefox settings.
  4. Observe the value of safe-area-inset-bottom as reflected in the page layout.

This issue started with Firefox 150+ on Android. It does not occur on iOS.

Actual results:

The address bar can be positioned at either the top or the bottom of the screen and, since Firefox 150, changing its position does not update the bottom safe area inset accordingly.

env(safe-area-inset-top) updates correctly when the address bar is moved.

However, env(safe-area-inset-bottom) always reports a value large enough to account for the bottom address bar, even when the address bar is positioned at the top. As a result, websites reserve unnecessary space at the bottom of the viewport, leaving an unusable blank area.

Expected results:

When the address bar is positioned at the top, env(safe-area-inset-bottom) should shrink to the actual bottom safe area. It should only include the address bar height when the address bar is positioned at the bottom.

The Bugbug bot thinks this bug should belong to the 'Firefox for Android::Browser Engine' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Browser Engine
Product: Firefox → Firefox for Android

Reporter, What device and android version?

Flags: needinfo?(github)

(In reply to Makoto Kato [:m_kato] from comment #2)

Reporter, What device and android version?

Tested Firefox versions:

  • Firefox 153.0.2 (Build #2016175759)
  • Firefox Nightly 155.0a1 (Build #2016176287)

Tested devices:

  • Zebra TC27 with Android 14
  • Google Pixel 6a with Android 17
  • Google Pixel 8 Pro with Android 17
  • Google Pixel 8a with Android version 17

The issue occurs on all tested phones. The amount of extra spacing varies depending on system settings such as font size, navigation mode (gesture or 3-button), and screen resolution.
When the address bar is moved to the bottom of the screen, the extra spacing disappears completely. When the address bar is placed at the top, the spacing returns.


In case the image above isn't loading: https://i.ibb.co/HDtQLcsw/ff-spacing-bug.png

I also tested on a Samsung Galaxy Tab Active4 Pro running Android 15.
The issue does not occur there, so it appears to affect only phones in portrait orientation.

Flags: needinfo?(github)

I guess that this issue occurs when address bar is top and dynamic toolbar is turned on. After scrolling a web page, this value will have correct value. This might be regression by bug 1994149 to support Edge-to-Edge on GeckoView (not Firefox).

Assignee: nobody → m_kato

When toolbar is shown with dynamic mode, the height of nsWindow isn't correct size. Real height is nsWindow's height - toolbar height. So bottom value of safe-area-inset might be incorrect with dynamic toolbar. Even if bug 1994149, when cutout is bottom, this issue also occurs.

Keywords: regression
Regressed by: 1994149

The severity field is not set for this bug.
:jonalmeida, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jonalmeida942)

The severity field is not set for this bug.
:jonalmeida, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(jonalmeida942)

Thanks for investigating this Makoto!

Component: Browser Engine → General
Flags: needinfo?(jonalmeida942)
Product: Firefox for Android → GeckoView
Version: Trunk → Firefox 150

safe-area-insets is computed from the display's safe area insets and
window rectangle. When dynamic toolbar is enabled, the viewport height
is computed from the window height and toolbar height.

So safe-area-insets should consider dynamic toolbar height too to
compute safe area insets.

When dynamic toolbar is shown or hidden, current window position is
rarely incorrect.

Actually, window position is computed in Display.onGlobalLayout. But
View's position is moved by setTranslation* etc,
gatherTransparentRegion and etc might not be called.

So if the toolbar height is changed, we recompute the window position.
Then if it changes, it notifies to Gecko.

(In reply to Makoto Kato [:m_kato] from comment #5)

When toolbar is shown with dynamic mode, the height of nsWindow isn't correct size. Real height is nsWindow's height - toolbar height. So bottom value of safe-area-inset might be incorrect with dynamic toolbar.

Can you elaborate this?

100lvh = nsWindow height + the toolbar height, 100svh = nsWindow height. What does the Real height mean? And this size value comes from nsWidget needs to be including the dynamic toolbar height, otherwise we will see blank area while the toolbar is hidden.

I want nsWindow height - dynamic toolbar height that is as visible height.

When enabling dynamic top toolbar, nsWindow is

  • Toobar state is Collapsed ... [0 132 1080 2205]
  • Toobar state is Expanded ... [0 300 1080 2205]

When disable it, nsWindow is

  • [0 300 1080 2037] <- This height is different for expand state of dynamic toolbar.

Also, enabling dynamic bottom toolbar, nsWindow is
Toobar is Expanded or Collapsed ... [0 132 1080 2205]

PresContext::GetVisualSize + toolbar height (with collapsed) might be better. I try it

The severity field is not set for this bug.
:owlish, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(bugzeeeeee)

I investigated this issue further on a Google Pixel 8a running Android 17.

I can reproduce the issue with both 3-button navigation and gesture navigation.

With 3-button navigation, GeckoView receives a bottom system-bar inset of 126 (in Android pixels). On a test page, however, env(safe-area-inset-bottom) is reported as approximately 48.3 CSS pixels.

With gesture navigation, GeckoView receives a bottom system-bar inset of 63, while env(safe-area-inset-bottom) is reported as approximately 24.15 CSS pixels.

I also added temporary logging around the GeckoView surface/window geometry. In the affected state, the surface extended below the top of the system navigation area.

As a test, I modified mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java and changed the value passed to Gecko from:

mDisplay.safeAreaInsetsChanged(insets.top, insets.right, insets.bottom, insets.left);

to:

mDisplay.safeAreaInsetsChanged(insets.top, insets.right, 0, insets.left);

With this change, env(safe-area-inset-bottom) was reported as 0 on the test page, and the issue was no longer reproduced.

This seems consistent with the dynamic-toolbar/window-geometry issue described in Comment 5 and with the approach being investigated in D319388/D319389.

I am reporting this as an additional observation rather than suggesting that the bottom inset should simply be forced to zero, since the correct behavior should presumably still account for the actual safe area when the toolbar/window geometry requires it.

Attachment #9627696 - Attachment is obsolete: true

I filed bug 2073972 before finding this one, and it looks like the same issue. I first noticed it on m.youtube.com, and it reproduces on Nightly 158.0a1 (Build ID 20260919215217) on an Android 34 emulator and a Galaxy S23 FE. Bug 2073972 has more detail, including a console snippet that reads env(safe-area-inset-bottom) directly. I’m happy to test patches if that helps.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: