Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Web] Fix extra new line when inputAction is not newline for a multil… #53453

Conversation

bleroux
Copy link
Contributor

@bleroux bleroux commented Jun 18, 2024

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.

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Jun 18, 2024
@bleroux bleroux requested review from mdebbar and justinmc June 18, 2024 13:58
Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for contributing this fix!

@bleroux bleroux added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 20, 2024
@auto-submit auto-submit bot merged commit d721351 into flutter:main Jun 20, 2024
29 checks passed
@bleroux bleroux deleted the web_fix_extra_newline_when_input_action_is_not_newline branch June 20, 2024 19:34
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 20, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 20, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 20, 2024
…150582)

flutter/engine@dd37cef...dda82d9

2024-06-20 [email protected] Update StandardMessageCodec.readValue to be @nullable (flutter/engine#53473)
2024-06-20 [email protected] [Web] Fix extra new line when inputAction is not newline for a multilâ�¦ (flutter/engine#53453)
2024-06-20 [email protected] Roll Dart SDK from 366eb1b4b308 to be6b533e07e7 (1 revision) (flutter/engine#53492)
2024-06-20 [email protected] Fix focus management for text fields (flutter/engine#51009)
2024-06-20 [email protected] Roll Dart SDK from cbd933e707e7 to 366eb1b4b308 (1 revision) (flutter/engine#53487)
2024-06-20 [email protected] Roll Skia from 17626ca22729 to 4471ee07e223 (1 revision) (flutter/engine#53486)
2024-06-20 [email protected] Roll Dart SDK from e403519a4436 to cbd933e707e7 (1 revision) (flutter/engine#53485)
2024-06-20 [email protected] Roll Skia from 4acebac47ea5 to 17626ca22729 (1 revision) (flutter/engine#53484)
2024-06-20 [email protected] Roll Skia from 199e1a49b091 to 4acebac47ea5 (1 revision) (flutter/engine#53482)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
sigurdm pushed a commit to sigurdm/flutter that referenced this pull request Jun 26, 2024
…lutter#150582)

flutter/engine@dd37cef...dda82d9

2024-06-20 [email protected] Update StandardMessageCodec.readValue to be @nullable (flutter/engine#53473)
2024-06-20 [email protected] [Web] Fix extra new line when inputAction is not newline for a multilâ�¦ (flutter/engine#53453)
2024-06-20 [email protected] Roll Dart SDK from 366eb1b4b308 to be6b533e07e7 (1 revision) (flutter/engine#53492)
2024-06-20 [email protected] Fix focus management for text fields (flutter/engine#51009)
2024-06-20 [email protected] Roll Dart SDK from cbd933e707e7 to 366eb1b4b308 (1 revision) (flutter/engine#53487)
2024-06-20 [email protected] Roll Skia from 17626ca22729 to 4471ee07e223 (1 revision) (flutter/engine#53486)
2024-06-20 [email protected] Roll Dart SDK from e403519a4436 to cbd933e707e7 (1 revision) (flutter/engine#53485)
2024-06-20 [email protected] Roll Skia from 4acebac47ea5 to 17626ca22729 (1 revision) (flutter/engine#53484)
2024-06-20 [email protected] Roll Skia from 199e1a49b091 to 4acebac47ea5 (1 revision) (flutter/engine#53482)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Web] Extra newline appears in textfield after clearing
2 participants