tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit c58d5b4ce1e0fb6f7efaecd1b2dae6e932ec313c
parent d545a3cc2c5fcee9edcfbd7229714e71d4afbd3d
Author: Mugurell <Mugurell@users.noreply.github.com>
Date:   Wed, 17 Dec 2025 16:06:37 +0000

Bug 1988730 - part 4 - Disable scrolling the browser toolbar while keyboard is open r=android-reviewers,moyin

Differential Revision: https://phabricator.services.mozilla.com/D275992

Diffstat:
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/FenixBrowserToolbarView.kt | 21+++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/FenixBrowserToolbarView.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/components/toolbar/FenixBrowserToolbarView.kt @@ -18,6 +18,7 @@ import mozilla.components.concept.engine.EngineView import mozilla.components.concept.toolbar.ScrollableToolbar import mozilla.components.support.ktx.android.view.findViewInHierarchy import mozilla.components.support.utils.KeyboardState +import mozilla.components.support.utils.ext.isKeyboardVisible import mozilla.components.support.utils.keyboardAsState import mozilla.components.ui.widgets.behavior.DependencyGravity.Bottom import mozilla.components.ui.widgets.behavior.DependencyGravity.Top @@ -39,7 +40,7 @@ abstract class FenixBrowserToolbarView( ) : ScrollableToolbar { init { - setupShowingToolbarsAfterKeyboardHidden() + setupToolbarBehaviorBasedOnKeyboardState() } abstract val layout: View @@ -79,8 +80,10 @@ abstract class FenixBrowserToolbarView( } override fun enableScrolling() { - (layout.layoutParams as CoordinatorLayout.LayoutParams).apply { - (behavior as? EngineViewScrollingBehavior)?.enableScrolling() + if (!parent.isKeyboardVisible()) { + (layout.layoutParams as CoordinatorLayout.LayoutParams).apply { + (behavior as? EngineViewScrollingBehavior)?.enableScrolling() + } } } @@ -163,14 +166,20 @@ abstract class FenixBrowserToolbarView( protected fun shouldShowTabStrip() = customTabSession == null && settings.isTabStripEnabled - private fun setupShowingToolbarsAfterKeyboardHidden() { + private fun setupToolbarBehaviorBasedOnKeyboardState() { parent.addView( ComposeView(parent.context).apply { setContent { val keyboardState by keyboardAsState() LaunchedEffect(keyboardState) { - if (keyboardState == KeyboardState.Closed) { - expand() + when (keyboardState) { + KeyboardState.Closed -> { + enableScrolling() + } + KeyboardState.Opened -> { + disableScrolling() + expand() + } } } }