Skip to content

text: fix stuck selection after clicking a link#2455

Open
linyisu wants to merge 1 commit into
longbridge:mainfrom
linyisu:fix/text-link-selection-stuck
Open

text: fix stuck selection after clicking a link#2455
linyisu wants to merge 1 commit into
longbridge:mainfrom
linyisu:fix/text-link-selection-stuck

Conversation

@linyisu

@linyisu linyisu commented Jun 10, 2026

Copy link
Copy Markdown

Description

Fixes an issue where dragging the mouse after clicking a link in a TextView causes an unintended text selection.

When a link is clicked, the MouseUp handler calls cx.stop_propagation() before opening the URL. This prevents the window-level TextSelectionController from receiving the event, leaving is_selecting stuck at true. Any subsequent mouse movement is then treated as a drag, highlighting text the user never intended to select.

This PR calls Root::end_text_selection(cx) before stop_propagation() in both link paths:

  • Plain inline links — crates/ui/src/text/inline.rs
  • Image links — crates/ui/src/text/node.rs

Screenshot

Before

before.mp4

After

after.mp4

How to Test

Open any story that renders a TextView containing a link (e.g. the Markdown story).

Click a link and let the browser open the URL.

Return to the app window and move the mouse without pressing any button.

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate.
  • Passed cargo run for story tests related to the changes.
  • Tested macOS, Windows and Linux platforms performance (if the change is platform-specific)

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