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

Swapping handles order is prevented #532

Merged
merged 1 commit into from Sep 15, 2021

Conversation

amantoux
Copy link
Collaborator

Closes issue #531

@amantoux
Copy link
Collaborator Author

@pulyaevskiy can you please review?

// if (newSelection.baseOffset >= newSelection.extentOffset)
// return; // don't allow order swapping.
if (newSelection.baseOffset >= newSelection.extentOffset)
return; // don't allow order swapping.
Copy link
Contributor

Choose a reason for hiding this comment

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

I have one question here. It looks like on iOS even though swapping is allowed it'll also result in actual handles swap.

Meaning if extent < base then we actually flip the values as well so that base becomes the lower value.

On Android, I believe, handles don't swap (but I might be wrong). Have you tested it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tested Flutter's TextField behavior on both iOS & Android. They behave the same => now swapping

But you are right, on iOS native text, selection handles do swap.

Should we mimic Flutter's TextField?
otherwise we need to define the desired behavior on each supported platforms

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha, I think we should stay consistent with what Flutter does so that we get the same behavior within a Flutter app as a whole.

Thanks for the details!

@pulyaevskiy pulyaevskiy self-requested a review September 15, 2021 03:43
Copy link
Contributor

@pulyaevskiy pulyaevskiy left a comment

Choose a reason for hiding this comment

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

LGTM

@pulyaevskiy pulyaevskiy merged commit 76676cc into memspace:1.0-dev Sep 15, 2021
@amantoux amantoux deleted the prevent-swapping-handles branch September 17, 2021 07:11
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.

None yet

2 participants