-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Send input action even in multiline editing mode #33428
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -353,7 +353,7 @@ Future<void> testMain() async { | |
// TODO(mdebbar): https://github.com/flutter/flutter/issues/50769 | ||
skip: browserEngine == BrowserEngine.edge); | ||
|
||
test('Does not trigger input action in multi-line mode', () { | ||
test('Triggers input action in multi-line mode', () { | ||
final InputConfiguration config = InputConfiguration( | ||
inputType: EngineInputType.multiline, | ||
inputAction: 'TextInputAction.done', | ||
|
@@ -373,8 +373,8 @@ Future<void> testMain() async { | |
keyCode: _kReturnKeyCode, | ||
); | ||
|
||
// Still no input action. | ||
expect(lastInputAction, isNull); | ||
// Input action is triggered! | ||
expect(lastInputAction, 'TextInputAction.done'); | ||
// And default behavior of keyboard event shouldn't have been prevented. | ||
expect(event.defaultPrevented, isFalse); | ||
}); | ||
|
@@ -1903,7 +1903,7 @@ Future<void> testMain() async { | |
// TODO(mdebbar): https://github.com/flutter/flutter/issues/50769 | ||
skip: browserEngine == BrowserEngine.edge); | ||
|
||
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 commentThe 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 commentThe 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. 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. |
||
showKeyboard( | ||
inputType: 'multiline', | ||
inputAction: 'TextInputAction.next', | ||
|
@@ -1915,8 +1915,14 @@ Future<void> testMain() async { | |
keyCode: _kReturnKeyCode, | ||
); | ||
|
||
// No input action and no platform message have been sent. | ||
expect(spy.messages, isEmpty); | ||
// Input action is sent as a platform message. | ||
expect(spy.messages, hasLength(1)); | ||
expect(spy.messages[0].channel, 'flutter/textinput'); | ||
expect(spy.messages[0].methodName, 'TextInputClient.performAction'); | ||
expect( | ||
spy.messages[0].methodArguments, | ||
<dynamic>[clientId, 'TextInputAction.next'], | ||
); | ||
// And default behavior of keyboard event shouldn't have been prevented. | ||
expect(event.defaultPrevented, isFalse); | ||
}); | ||
|
Uh oh!
There was an error while loading. Please reload this page.