Skip to content

Fix TextField selection stuck when target stops mouseUp propagation#2871

Open
Tutez64 wants to merge 1 commit into
openfl:developfrom
Tutez64:bugfix/textfield-mouseup-capture-selection-
Open

Fix TextField selection stuck when target stops mouseUp propagation#2871
Tutez64 wants to merge 1 commit into
openfl:developfrom
Tutez64:bugfix/textfield-mouseup-capture-selection-

Conversation

@Tutez64

@Tutez64 Tutez64 commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a Flash/AIR parity issue where TextField text selection could remain in a "mouse drag" state after the button was released.

When application code adds a target-phase mouseUp listener on a TextField and calls stopImmediatePropagation() (a pattern used in Flash UIs to isolate clicks from gameplay), OpenFL's stage_onMouseUp handler never ran because it was registered on the stage in the bubble phase. The stage MOUSE_MOVE listener was never removed, so moving the pointer continued to extend the selection without buttonDown.

AIR did not show this behavior with the same listener setup.

Fix

Register and remove stage_onMouseUp with useCapture = true so selection teardown runs during the capture phase, before target listeners can stop propagation.

Repro

OpenFLTextFieldMouseUpCaptureRepro.zip

Register stage_onMouseUp in capture phase so selection cleanup runs before target-phase listeners call stopImmediatePropagation(). Without this, MOUSE_MOVE stays active and text keeps selecting after release, which differs from Flash behavior.
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.

1 participant