Fix blank space in browser activity#8537
Open
aibrahim- wants to merge 1 commit into
Open
Conversation
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/1212608036467427/task/1214444878566531?focus=true
Description
If a page load completes (which triggers
computeBottomMarginIfNeeded), while a keyboard is being launched at the same time, there's a window where the child (browserLayout) would still be smaller in height than the parent (rootView), this would happen mid-layout and it would later match the parent size, but this causes thecomputeBottomMarginIfNeededto incorrectly adjusts the browserLayout to match its parent and adds a persistent diff that is exactly the keyboard IME size.Steps to test this PR
This is a race-condition that's hard to replicate, so it will need mutliple tries. also for some-reason enabling native-input with the toggle disabled makes it easier to repro.
I was able to verify the fix by having a log in the if statement added here, this log always triggers when the bug repros, and with the fix in place, the bug doesn't repro anymore.
Note
Low Risk
Low risk: small, localized guard in
CoordinatorLayoutHelper.computeBottomMarginIfNeededto avoid applying an incorrect margin during an IME/layout race; main risk is skipping a needed margin update in some edge cases until the next layout pass.Overview
Prevents a race where
computeBottomMarginIfNeededcould permanently add the keyboard (IME) height to the child view’sbottomMarginwhile the parent is mid-resize.The method now snapshots
childHeight/parentHeightand bails out when the child reports a height larger than the parent, without updatinglastYPosition, so a later call can recompute once layout has settled.Reviewed by Cursor Bugbot for commit f5b8822. Bugbot is set up for automated code reviews on this repo. Configure here.