Skip to content

[Kotlin]: disable drag handle during .present() - #601

Draft
kieran-osgood-shopify wants to merge 1 commit into
android-duplicate-checkout-crashfrom
kieran-osgood/android-sheet-opens-when-tapped
Draft

[Kotlin]: disable drag handle during .present() #601
kieran-osgood-shopify wants to merge 1 commit into
android-duplicate-checkout-crashfrom
kieran-osgood/android-sheet-opens-when-tapped

Conversation

@kieran-osgood-shopify

@kieran-osgood-shopify kieran-osgood-shopify commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

What changes are you making?

If a user is tapping the checkout button it's possible they'd accidentally grab the sheet and have it open at a height that wasn't an intentional snap point

Adding a guard when initial open animation is in progress to hold back a user from being able to user drag handle

Screen Recording 2026-08-06 at 12.14.21.mov (uploaded via Graphite)


Before you merge

Important

  • I've added tests to support my implementation
  • I have read and agree with the Contribution Guidelines
  • I have read and agree with the Code of Conduct
  • I've updated the relevant platform README (platforms/swift/README.md and/or platforms/android/README.md)

Releasing a new Swift version?
  • I have bumped the version in ShopifyCheckoutKit.podspec
  • I have bumped the version in platforms/swift/Sources/ShopifyCheckoutKit/ShopifyCheckoutKit.swift
  • I have updated the SwiftPM/CocoaPods version snippets in platforms/swift/README.md (major version only)
Releasing a new Embedded Checkout Protocol version?
  • I have bumped embeddedCheckoutProtocolAndroid in platforms/android/gradle/libs.versions.toml
  • I have updated protocol/languages/kotlin/embedded-checkout-protocol/api/embedded-checkout-protocol.api if the public API changed
Releasing a new Android version?
  • I have bumped checkoutKitAndroid in platforms/android/gradle/libs.versions.toml
  • I have updated the Gradle/Maven version snippets in platforms/android/README.md

Tip

See the Contributing documentation for the full release process per platform.

…tion

### TLDR

A tap during the 260 ms open animation left the checkout sheet frozen part way up the screen. It never reached full height, and it never settled back.

### What

`resetGesture` and `startScrollableChildGesture` both call `animate().cancel()` on `ACTION_DOWN`, and the partial `translationY` then becomes a permanent top offset. A tap that never passes `touchSlop` ends with only `performClick()`, so nothing settles the sheet open again.

`CheckoutBottomSheetLayout` now tracks `openAnimationRunning` beside the existing `dismissAnimationRunning`, and `canHandleDragToDismiss` requires both to be false. Touches during opening pass straight through to checkout content. `withEndAction` clears the flag, and it also runs on cancel, so the flag cannot stick.

`canHandleDragToDismiss` gates all four gesture entry points, so this one getter change covers every path. The new field is private, so `lib/api/lib.api` does not move.

### How to test

Open checkout in the Kotlin sample, then tap the sheet about 120 ms after it starts to open. The measurement below is the screen row of the sheet top edge, where 216 is fully open on the test display.

| Round | Before | After |
| --- | --- | --- |
| 1 | 451 | 216 |
| 2 | 812 | 216 |
| 3 | 387 | 216 |

`CheckoutBottomSheetTest.kt` adds two cases: the sheet reaches the fully open position after a tap during the open animation, and drag to dismiss still works once that animation completes.

Robolectric completes a `ViewPropertyAnimator` on the first looper idle regardless of duration, so the first test asserts from the state immediately after `animateIn()` rather than by advancing the clock.

Assisted-By: devx/c27c154c-e79d-4f1f-9300-c3258c6f34f9

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kieran-osgood-shopify kieran-osgood-shopify changed the title fix(android): keep the sheet opening when the buyer taps it mid-animation [Kotlin] keep the sheet opening when the buyer taps it mid-animation Aug 7, 2026
@kieran-osgood-shopify kieran-osgood-shopify changed the title [Kotlin] keep the sheet opening when the buyer taps it mid-animation [Kotlin]: disable drag handle during .present() Aug 7, 2026
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.

2 participants