JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.24k stars 1.11k forks source link

Dragging to scroll clears selection #4951

Open m-sasha opened 2 weeks ago

m-sasha commented 2 weeks ago

On iOS (or other platforms with touch), the current selection is cleared on touch-up in SelectionContainer after dragging to scroll.

Affected platforms

Versions

To Reproduce

  1. Run the mpp demo on iOS.
  2. In the SelectionContainer demo, in the scrollable text, select some text
  3. Drag the scrollable. Note that on touch-up, the selection is cleared.

Expected behavior Selection should not be cleared.

Screenshots https://github.com/JetBrains/compose-multiplatform/assets/5230206/e41a45cc-0f42-480a-8420-5fb2230b99b0

Additional context The selection is cleared by SelectionManager.Modifier.onClearSelectionRequested, because the scroll is not recognized as a drag, so basically it thinks it was a click (because the pointer didn't move relative to the element).