Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text handle drag swap on Apple platforms #105069

Merged
merged 5 commits into from Jun 10, 2022

Conversation

justinmc
Copy link
Contributor

On iOS, dragging the base handle causes it to become the extent handle, so that subsequent "shift + arrow key" events move the previously dragged handle.

Discovered while working on #102992.

This video shows the correct iOS behavior after this PR.

Screen.Recording.2022-05-31.at.4.02.42.PM.mov

@justinmc justinmc self-assigned this May 31, 2022
@flutter-dashboard flutter-dashboard bot added a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 31, 2022
Copy link
Contributor

@LongCatIsLooong LongCatIsLooong left a comment

Choose a reason for hiding this comment

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

If you swap the handles, the same gesture recognizer callback is still registered to the same handle under the touch point is it?

// On Apple platforms, dragging the base handle makes it the extent.
case TargetPlatform.iOS:
case TargetPlatform.macOS:
final int endOffset = math.max(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: _selection.end?

@justinmc
Copy link
Contributor Author

justinmc commented Jun 7, 2022

If you swap the handles, the same gesture recognizer callback is still registered to the same handle under the touch point is it?

I'm going to double check that the correct callbacks are called when I'm at home where my Mac is.

@justinmc justinmc force-pushed the apple-text-handle-swap branch 2 times, most recently from 98c6e71 to c7b4ea6 Compare June 8, 2022 18:41
@justinmc
Copy link
Contributor Author

justinmc commented Jun 8, 2022

The callbacks were correct; the left handle is always the "start" handle and the right handle is always the "end", regardless of whether they represent the base or offset. However, I was missing a case where the handles were already reversed before the drag started. I also added on to the test to cover that case.

@justinmc justinmc merged commit 213bf37 into flutter:master Jun 10, 2022
@justinmc justinmc deleted the apple-text-handle-swap branch June 10, 2022 16:20
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 10, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Jun 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 11, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 12, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 12, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 13, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 13, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 14, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jun 14, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
Dragging the base text selection handle on Apple makes it the extent.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/plugins that referenced this pull request Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: text input Entering text in a text field or keyboard related problems f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants