Skip to content

UI: improve swipe to dismiss reliability on More bottom sheet#6746

Open
Akul-Tyagi wants to merge 1 commit intocommons-app:mainfrom
Akul-Tyagi:fix/more-sheet-swipe-dismiss
Open

UI: improve swipe to dismiss reliability on More bottom sheet#6746
Akul-Tyagi wants to merge 1 commit intocommons-app:mainfrom
Akul-Tyagi:fix/more-sheet-swipe-dismiss

Conversation

@Akul-Tyagi
Copy link
Contributor

@Akul-Tyagi Akul-Tyagi commented Mar 17, 2026

Fixes #6744

The Problem

Currently, the "More" bottom sheet content is wrapped in a standard ScrollView. BottomSheetBehavior relies on nested scrolling signals from child content to handle drag and dismiss gestures. Because plain ScrollView does not consistently hand off these gesture signals, the swipe down to dismiss behavior is flaky and often fails to register.

The Solution & Justification

I replaced ScrollView with NestedScrollView in both fragment_more_bottom_sheet.xml and fragment_more_bottom_sheet_logged_out.xml. NestedScrollView is specifically designed to interoperate with BottomSheetBehavior, ensuring reliable nested scroll handoffs so the swipe-down gesture consistently dismisses the modal.

Additionally, I ensured the android:nestedScrollingEnabled="true" attribute was completely omitted from the layout XML. Keeping that attribute on certain device configurations triggers an InflateException (NPE) during inflation. Removing it keeps the fix minimal and crash-safe while preserving the improved scroll behavior.

Alternative Solutions Considered

I briefly considered keeping the ScrollView and programmatically overriding the touch interception logic directly inside the Fragment or tuning the BottomSheetBehavior callbacks in Kotlin. However, I discarded this approach because it introduces unnecessary code complexity. Updating the XML to use the framework-recommended NestedScrollView achieves the correct behavior with a much smaller, cleaner footprint.

Testing Performed

  • Compiled and ran the betaDebug variant successfully.
  • Manually tested the "More" bottom sheet in both logged-in and logged-out states.
  • Verified that the swipe down gesture now consistently and smoothly dismisses the modal on the first try.
  • Checked Logcat to ensure no InflateException or other regressions occur during layout inflation.

Videos
Before (Flaky dismiss):

Screen_Recording_20260316_201319_Commons.mp4

After (Smooth dismiss):

Screen_Recording_20260316_201449_Commons.mp4

Replaced ScrollView with NestedScrollView and removed nestedScrollingEnabled to prevent inflation crashes while ensuring smooth dismissal.
@neeldoshii neeldoshii self-requested a review March 17, 2026 10:34
@github-actions
Copy link

✅ Generated APK variants!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Inconsistent swipe to dismiss behavior on "more" bottom sheet

1 participant