material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

Bug with the ripple effect in widgets

Open HehehBoiii78 opened this issue 1 year ago • 0 comments
trafficstars

Description: The ripple effect of: a menu in the top app bar, a list item in a drop-down menu, single-choice or multi-choice items in a Material 3 dialog and a ListView - doesn't start from the location of the touch properly. This problem has been sickening for years at this point. In the "Steps to reproduce" section, I've only shown one widget which does have this issue as an example, but in the attachment attached, other widgets affected by this issue are shown as well.

Steps to reproduce:

  1. Create a new project in Android Studio.
  2. Add a "Menu" to the "Toolbar" of the project. (Add a Toolbar first if it isn't there already) • Jetpack Compose must not be used to reproduce this bug, as this issue isn't present in it. Instead, use any version of the library provided by this repository (Material Components for Android).
  3. Add items to the menu.
  4. Touch and hold an item in the menu. • At first, the ripple starts from the center of the item.
  5. Touch and hold the same item again. • Then, from where you touched the item last time, the ripple will start from there.
  6. Touch and hold the same item once again. • Then, from where you touched the item last time, the ripple will start from there.

Expected behavior: The ripple should start from the location of the touch everytime, not from a completely different location.

Source code: Not applicable.

Minimal sample app repro: The attachment below has a ZIP file which contains the source code of an app which exactly demonstrates the issue outlined. Bug_Demo.zip

Android API version: Not applicable

Material Library version: Happens with any version of this library.

Device: Any Android device (as I've not tested this on iPhones yet).

Additional text: In the drop-down menu present in the provided app, the ripple is even weird. The ripple first starts from the correct location, then starts only from the center if the same item is interacted with repeatedly.

If this 'bug' is intentional:

  1. Adding ripple effects to LinearLayouts is perfectly functional and it starts from the correct location everytime, and quickly.
  2. If this was made for a performance increase (I'm just speculating), that's invalid because: • If the ripple in the menu starts from the previous location when the same item is interacted with, then that means the ripple-location-tracking is working alltime. • Normal ripple effects behave normally, without any delay.

HehehBoiii78 avatar Aug 07 '24 13:08 HehehBoiii78