You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix WebView offset when navigation bar enabled and keyboard visible (#5931)
Task/Issue URL:
https://app.asana.com/1/137249556945/project/1208671518894266/task/1210010551182684?focus=true
### Description
Fixes an issue where navigation bar, even when gone when keyboard is
inflated, would still retain the offset applied to the web view content.
The fix is to notify the coordinator layout that navigation bar changed,
when its visibility changes, which doesn't happen by default.
We already have handling of that available in the behavior that adjusts
browsers padding:
https://github.com/duckduckgo/Android/blob/c0e22478de53029ceb4f6f80188c97782a74562a/app/src/main/java/com/duckduckgo/app/browser/webview/BrowserContainerLayoutBehavior.kt#L53-L78
Furthermore I'm fixing the issue where `browserLayout` wasn't observing the bottom omnibar directly. Instead, it synced its offset with transitions in `BottomAppBarBehavior`, which only responds to web view scrolls. As a result, changes to the omnibar triggered by other sources were ignored.
The bottom omnibar includes the bottom navigation bar, which we hide when the keyboard appears. This alters the omnibar's size, but since `BottomAppBarBehavior` only reacted to scroll events, it didn’t update the web view's padding/margin accordingly.
I removed the hardcoded `browserLayout` adjustments tied to `BottomAppBarBehavior`. Instead, I updated `BrowserContainerLayoutBehavior` to apply correct padding for all bottom omnibar changes, whether triggered by scroll or size adjustments.
* A [ScrollingViewBehavior] that additionally observes the position of [BrowserNavigationBarView], if present,
29
-
* and applies bottom padding to the target view equal to the visible height of the navigation bar.
30
+
* A [ScrollingViewBehavior] that additionally observes the position of [BrowserNavigationBarView] or bottom [OmnibarLayout], if present,
31
+
* and applies bottom padding to the target view equal to the visible height of the bottom element.
30
32
*
31
-
* This prevents the navigation bar from overlapping with, for example, content found in the web view.
33
+
* This prevents the bottom element from overlapping with, for example, content found in the web view.
32
34
*
33
-
* Note: This behavior is intended for use with the top omnibar. When the bottom omnibar is used,
34
-
* it already includes the navigation bar, so no additional coordination is required.
35
+
* Note: [BrowserNavigationBarView] or bottom [OmnibarLayout] will never be children of the coordinator layout at the same time, so they won't be competing for updates:
36
+
* - When top [OmnibarLayout] is used, [BrowserNavigationBarView] is added directly to the coordinator layout.
37
+
* - When bottom [OmnibarLayout] is used, it comes embedded with the [BrowserNavigationBarView].
35
38
*/
36
39
classBrowserContainerLayoutBehavior(
37
40
context:Context,
@@ -43,23 +46,19 @@ class BrowserContainerLayoutBehavior(
0 commit comments