Skip to content

Handle touch events in text editor - #3442

Open
eliotbo wants to merge 1 commit into
iced-rs:masterfrom
eliotbo:text-editor-touch-support
Open

Handle touch events in text editor#3442
eliotbo wants to merge 1 commit into
iced-rs:masterfrom
eliotbo:text-editor-touch-support

Conversation

@eliotbo

@eliotbo eliotbo commented Aug 30, 2026

Copy link
Copy Markdown

Adds an Event::Touch group to Editor::update in core/src/text/editor.rs, mirroring the existing left-mouse-button arms: FingerPressed behaves like a left-button press (focus, caret placement via mouse::Click, multi-click detection), FingerMoved while pressed drags the selection, FingerLifted/FingerLost release, and a tap outside the bounds unfocuses.

This makes text_editor usable on touch screens; previously a finger or pen could not even focus it. The implementation relies on the runtime keeping the virtual mouse cursor at the touch position (as other touch-aware widgets do), so cursor.position_in(bounds) is valid in the touch arms.

Battle-tested: this is the upstreamed version of a patch we've shipped in a stylus-driven audiology app on Windows tablets.

Fixes #3441.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UadsnP3Wd2fvzeUzh2oWFx

Mirror the left-mouse-button arms for touch input, so a finger or pen
can focus a text editor, place the caret, drag-select, and unfocus by
tapping outside — none of which worked on touch screens before.

Co-Authored-By: Claude Code Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UadsnP3Wd2fvzeUzh2oWFx
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.

text_editor doesn't respond to touch input

1 participant