Skip to content

Minimal fix for missed pointerup after drug in Safari#3011

Merged
Shagen Ogandzhanian (Schahen) merged 1 commit into
jb-mainfrom
sh/CMP-10102-dnd-safari-click-fix
Apr 24, 2026
Merged

Minimal fix for missed pointerup after drug in Safari#3011
Shagen Ogandzhanian (Schahen) merged 1 commit into
jb-mainfrom
sh/CMP-10102-dnd-safari-click-fix

Conversation

@Schahen

@Schahen Shagen Ogandzhanian (Schahen) commented Apr 24, 2026

Copy link
Copy Markdown

This is the most possible non-invasive way to fix the bug that exists in safari with processing pointer events after drag cancellation

Testing

manual

Release Notes

Fixes - Web

  • [Safari] Fix an issue where buttons required a second click to respond after performing drag-and-drop operations

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a Safari-specific pointer state issue after drag-and-drop where pointerup may not fire, leaving Compose Web input state inconsistent and causing the next click to be ignored.

Changes:

  • Add a global "dragend" listener in the Web ComposeWindow to reset actualActivePointerButtons when Safari misses pointerup.
  • Update the Web drag-and-drop demo to start with the target enabled by default.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/window/ComposeWindowInternal.web.kt Resets tracked mouse button state on global dragend to mitigate Safari missing pointerup after DnD.
compose/mpp/demo/src/webMain/kotlin/androidx/compose/mpp/demo/components/DragAndDropExample.web.kt Changes initial demo state so the DnD target is enabled by default on Web.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

state.globalEvents.addDisposableEvent("dragend") {
// in Safari pointerup event is not firing when we drop or cancel drop
Comment on lines +391 to +395
state.globalEvents.addDisposableEvent("dragend") {
// in Safari pointerup event is not firing when we drop or cancel drop
// see https://youtrack.jetbrains.com/issue/CMP-10102
actualActivePointerButtons = null
}
val exportedText = "Hello, DnD!"

var isTargetEnabled by remember { mutableStateOf(false) }
var isTargetEnabled by remember { mutableStateOf(true) }
@Schahen Shagen Ogandzhanian (Schahen) merged commit a51049b into jb-main Apr 24, 2026
21 checks passed
@Schahen Shagen Ogandzhanian (Schahen) deleted the sh/CMP-10102-dnd-safari-click-fix branch April 24, 2026 13:55
Ekaterina Zaitseva (sekater) added a commit that referenced this pull request Apr 24, 2026
🍒 Cherry-pick of a51049b

This is the most possible non-invasive way to fix the bug that exists in
safari with processing pointer events after drag cancellation

manual

- [CMP-10102](https://youtrack.jetbrains.com/issue/CMP-10102) [Web]
Safari. DragAndDrop. After performing drag and drop operations buttons
are unclickable on the first attempt

Describe proposed changes and the issue being fixed

(Optional) Fixes [link to the issue]

## Testing
manual

## Release Notes
### Fixes - Web
- [CMP-10102](https://youtrack.jetbrains.com/issue/CMP-10102) [Web]
Safari. DragAndDrop. After performing drag and drop operations buttons
are unclickable on the first attempt
Sajid Ali (sajidalidev) pushed a commit to sajidalidev/compose-multiplatform-core-tvos that referenced this pull request May 6, 2026
This is the most possible non-invasive way to fix the bug that exists in
safari with processing pointer events after drag cancellation

manual

- [CMP-10102](https://youtrack.jetbrains.com/issue/CMP-10102) [Web]
Safari. DragAndDrop. After performing drag and drop operations buttons
are unclickable on the first attempt
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.

3 participants