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

[SuperEditor][SuperReader][Android] Fix scrolling with an ancestor Scrollable (Resolves #1535) #1536

Merged

Conversation

angelosilvestre
Copy link
Collaborator

[SuperEditor][SuperReader][Android] Fix scrolling with an ancestor Scrollable. Resolves #1535.

When the editor or reader is inside a CustomScrollview, trying to drag is opening the software keyboard and changing the selection.

The root cause is the long press to select handling. When the user taps down we start a timer to track a long press. Dragging after the tap down starts a pan gesture and we cancel the timer. However, if we have an ancestor Scrollable, dragging starts a pan gesture on the Scrollable, not in the editor/reader. Because of that, the timer still fires after the timeout.

This PR adds a guard clause to avoid doing a long press if we are scrolling.

@@ -581,6 +581,60 @@ void main() {
expect(caretOffset.dy, greaterThanOrEqualTo(screenSizeWithKeyboard.height - trailingBoundary));
});

testWidgetsOnMobile('scrolls when dragging without attaching to IME', (tester) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test name should probably read "scrolling doesn't cause the keyboard to open"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated.

Copy link
Contributor

@matthew-carroll matthew-carroll left a comment

Choose a reason for hiding this comment

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

LGTM

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.

[SuperEditor] Scrolling on Android in a CustomScrollView creates selection when it shouldn't
2 participants