Fix grey gap in split omnibar during snap animation#7883
Open
Fix grey gap in split omnibar during snap animation#7883
Conversation
49f60f6 to
1d11536
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Missing requestLayout after modifying bottomMargin in correction
- Added
child.postOnAnimation { child.requestLayout() }after settinglp.bottomMarginto trigger a layout pass, matching the pattern used in TopAppBarBehavior and BottomAppBarBehavior.
- Added
Or push these changes by commenting:
@cursor push af4c49f29a
Preview (af4c49f29a)
diff --git a/app/src/main/java/com/duckduckgo/app/browser/webview/BrowserContainerLayoutBehavior.kt b/app/src/main/java/com/duckduckgo/app/browser/webview/BrowserContainerLayoutBehavior.kt
--- a/app/src/main/java/com/duckduckgo/app/browser/webview/BrowserContainerLayoutBehavior.kt
+++ b/app/src/main/java/com/duckduckgo/app/browser/webview/BrowserContainerLayoutBehavior.kt
@@ -77,6 +77,7 @@
val newMargin = if (diff > 0) diff else 0
if (lp.bottomMargin != newMargin) {
lp.bottomMargin = newMargin
+ child.postOnAnimation { child.requestLayout() }
}
}
}
app/src/main/java/com/duckduckgo/app/browser/webview/BrowserContainerLayoutBehavior.kt
Show resolved
Hide resolved
0nko
requested changes
Mar 6, 2026
Contributor
Author
|
This is a great catch, thanks for testing it! I reverted back the helper as it was doing the initial bottomMargin calculations correctly, my changes will only take effect in a scrollable page. You can find latest build in the asana task. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Conflicting margin mechanisms cause transient visual artifact
- Added an early-return guard in computeBottomMarginIfNeeded() that skips the incremental margin adjustment when the coordinator child's behavior is TopOmnibarBrowserContainerLayoutBehavior, since that behavior already manages bottom margin authoritatively via correctBottomMargin().
Or push these changes by commenting:
@cursor push 610fd80574
Preview (610fd80574)
diff --git a/app/src/main/java/com/duckduckgo/app/browser/CoordinatorLayoutHelper.kt b/app/src/main/java/com/duckduckgo/app/browser/CoordinatorLayoutHelper.kt
--- a/app/src/main/java/com/duckduckgo/app/browser/CoordinatorLayoutHelper.kt
+++ b/app/src/main/java/com/duckduckgo/app/browser/CoordinatorLayoutHelper.kt
@@ -21,6 +21,7 @@
import android.view.View
import android.view.ViewParent
import androidx.coordinatorlayout.widget.CoordinatorLayout
+import com.duckduckgo.app.browser.webview.TopOmnibarBrowserContainerLayoutBehavior
class CoordinatorLayoutHelper {
@@ -64,6 +65,11 @@
return
}
+ val lp = coordinatorChildView!!.layoutParams as? CoordinatorLayout.LayoutParams
+ if (lp?.behavior is TopOmnibarBrowserContainerLayoutBehavior) {
+ return
+ }
+
val childBounds = IntArray(2)
coordinatorChildView!!.getLocationOnScreen(childBounds)
if (childBounds[1] != lastYPosition) {
app/src/main/java/com/duckduckgo/app/browser/webview/BrowserContainerLayoutBehavior.kt
Show resolved
Hide resolved
0b721ac to
846404a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Task/Issue URL: https://app.asana.com/1/137249556945/project/715106103902962/task/1212150815656027?focus=true
Description
n split omnibar mode, releasing a scroll mid-collapse causes a grey gap where the navigation bar was. The AppBarLayout snap animation auto-collapses the omnibar, but
CoordinatorLayoutHelperstops receivingonOverScrolledcallbacks during snap, leaving a stalebottomMarginon the browser layout.Fix: Replace
CoordinatorLayoutHelper's async margin correction (via post()) with a synchronous correction inTopOmnibarBrowserContainerLayoutBehavior.onDependentViewChanged. This fires on every frame during snap, to compute the correct margin.This will also fix another visual bug, where while scrolling down, there was a visible visual artifact which was happening because bottomMargin adjustments were taking place at later frames after the scrolling actually takes place.
Steps to test this PR
UI changes
Note
Medium Risk
Changes CoordinatorLayout margin calculations during AppBarLayout scroll/snap, which can affect web content layout across devices and omnibar configurations. Risk is limited to UI behavior (no security/data logic) but could introduce new visual regressions if the margin math is off.
Overview
Fixes the split/top omnibar “grey gap” by moving browser-container bottom-margin correction from an async
postinDuckDuckGoWebView.onOverScrolledto a synchronous, per-frame adjustment inTopOmnibarBrowserContainerLayoutBehavior.onDependentViewChanged.Adds
correctBottomMarginlogic (with a small 7dp offset during partial collapse to reduce flicker) and introduces an instrumentation test suite covering expanded/collapsed/partial and edge-case margin calculations.Written by Cursor Bugbot for commit 846404a. This will update automatically on new commits. Configure here.