diff --git a/lib/java/com/google/android/material/appbar/AppBarLayout.java b/lib/java/com/google/android/material/appbar/AppBarLayout.java index 085356b7ba3..f775bb5f4f0 100644 --- a/lib/java/com/google/android/material/appbar/AppBarLayout.java +++ b/lib/java/com/google/android/material/appbar/AppBarLayout.java @@ -537,7 +537,12 @@ private boolean hasCollapsibleChild() { private void invalidateScrollRanges() { // Saves the current scrolling state when we need to recalculate scroll ranges - SavedState savedState = behavior == null || totalScrollRange == INVALID_SCROLL_RANGE + // If the total scroll range is not known yet, the ABL is never scrolled. + // If there's a pending action, we should skip this step and respect the pending action. + SavedState savedState = + behavior == null + || totalScrollRange == INVALID_SCROLL_RANGE + || pendingAction != PENDING_ACTION_NONE ? null : behavior.saveScrollState(AbsSavedState.EMPTY_STATE, this); // Invalidate the scroll ranges totalScrollRange = INVALID_SCROLL_RANGE;