material-components / material-components/material-components-android

[AppBarLayout] Scrolling animation is broken if the first swipe on header and the second was on the content

Open
#2,320 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug Widget: TopAppBar
Dominant language
Java
Stars
17.4k
Forks
3.2k
PR merge metrics
No merged PRs in 30d

Description

**Description:** If in the view structure with AppBarLayout, CollapsingToolbarLayout and a RecyclerView you swipe to the top on the AppBarLayout and then immediately down on the recycler (or just press and hold the recycler), the animation is broken. ([as you can see in the sample repo](https://github.com/maxim-pandra/CollapsingToolbarBug))
This can be reproduced across almost every app on GooglePlay (for example, Youtube music, Spotify and every app that uses CollapsingToolbarLayout suffers from this bug). I found this issue because I needed a big collapsing toolbar (more than half of the screen) so, the first swipe often happens on the toolbar itself.

Video is available in my [sample repo](https://github.com/maxim-pandra/CollapsingToolbarBug/tree/master/screen_recordings). Animation is not the best way to show how bad this is =) The best way is to try it on the phone in for example Spotify artist/album screen

**Expected behavior:** third animation in my [sample repo](https://github.com/maxim-pandra/CollapsingToolbarBug) iow animation should stop when finger is placed on recycler, or should immediatelly scroll down after a swipe on recycler

**Source code:** https://github.com/maxim-pandra/CollapsingToolbarBug

**Android API version:** Any api. For example android 11, 10 and probably any other

**Material Library version:** dependency block:
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'

**Device:** Any device or emulator. For exaple samsung galaxy note 20 / or android 11 emulator

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the interaction in the linked CollapsingToolbarBug sample with AppBarLayout, CollapsingToolbarLayout, and RecyclerView. Then trace the touch and scrolling behavior in those components using the sample's dependency versions. Done means the animation stops when the finger reaches the RecyclerView or scrolling immediately reverses after the second swipe.

Written by the indexing model from the issue text.

Assessment

Tech stack
android
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.