-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Send input action even in multiline editing mode #33428
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the "maybe breaking change" comment, LGTM!
test('does not send input action in multi-line mode', () { | ||
test('sends input action in multi-line mode', () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know how many people relied in the old behavior? Is this going to be a breaking change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, multiline text fields have the action TextInputAction.newline as you can see here:
This PR doesn't change the behavior of the above default action.
What this PR changes is the case where the user provides a different action (e.g. TextInputAction.done
). In this case, the user is specifically asking us to perform the "done" action when ENTER is clicked. But we used to ignore that and treat everything as a "newline" action in multiline text fields. That was a BUG on our side.
I don't see a reason for users to rely on the old behavior because they could've just left everything at default and got the same behavior.
#53453) ## Description This PR prevents new line key event from being dispatched for a multiline text field when `TextField.textInputAction` is not `TextInputAction.newline`. Since #33428, web engine does not prevent new line key events. In #36893, I fixed a similar issue for single line text fields. At that time I was not sure if we want to fix it for multiline text fields. I checked again on non-web platforms (macos, iOS, Android) and the new line is not added if the input action is not `TextInputAction.newline`. For a **multiline field**, the default text input action is `TextInputAction.newline`. If the developer sets text input action to another value: - before this PR, the action is performed and a new line is added. - after this PR, the action is performed but no new line is added. ## Related Issue Fixes flutter/flutter#145051 ## Tests Adds 1 tests, updates 3 tests.
On non-web platforms, the engine always sends an input action message to the framework when ENTER is clicked (regardless of the field being single or multi-line).
On the web, we don't send an input action for multi-line fields. This PR fixes it so we always send an input action just like the native engine does.
Fixes flutter/flutter#99900