Skip to content

Conversation

@justinmc
Copy link
Contributor

Description

If you long press an empty text field, then the selection menu shows, but if you type some content and then delete it all so it's empty again, the menu doesn't show. This PR fixes that.

Related Issues

Closes #35998

Tests

Tested adding text, deleting it, and then showing the menu in editable_text_test.dart.

@justinmc justinmc added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. labels Jul 26, 2019
@justinmc justinmc requested a review from HansMuller July 26, 2019 22:10
@justinmc justinmc self-assigned this Jul 26, 2019
}
}

void _hideSelectionOverlayIfNeeded() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think some of the problem came from the fact that there are two subtly different methods with confusing names: _hideSelectionOverlayIfNeeded and hideToolbar. I got rid of this one altogether and I think it makes more sense now.

Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

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

LGTM

});

tearDown(() {
controller = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

controller.dispose() first?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch.

await tester.pump();
expect(find.text('PASTE'), findsOneWidget);

// Hide the toolbar and clear the text and selection.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe factor this out as a separate test and mark it as a regression test for #35998

@justinmc justinmc merged commit d82bca2 into flutter:master Jul 31, 2019
@justinmc justinmc deleted the selection-menu-after-clear branch July 31, 2019 15:01
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selection menu doesn't show after entering text then clearing/deleting

3 participants